#define NONSTD_OPTIONAL_LITE_HPP
#define optional_lite_MAJOR 3
-#define optional_lite_MINOR 5
+#define optional_lite_MINOR 6
#define optional_lite_PATCH 0
#define optional_lite_VERSION optional_STRINGIFY(optional_lite_MAJOR) "." optional_STRINGIFY(optional_lite_MINOR) "." optional_STRINGIFY(optional_lite_PATCH)
# if defined(_MSC_VER)
# include <cstddef> // for _HAS_EXCEPTIONS
# endif
-# if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || (_HAS_EXCEPTIONS)
+# if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || (defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS))
# define optional_CONFIG_NO_EXCEPTIONS 0
# else
# define optional_CONFIG_NO_EXCEPTIONS 1
# endif
#endif
-// C++ language version detection (C++20 is speculative):
+// C++ language version detection (C++23 is speculative):
// Note: VC14.0/1900 (VS2015) lacks too much from C++14.
#ifndef optional_CPLUSPLUS
#define optional_CPP11_OR_GREATER_ ( optional_CPLUSPLUS >= 201103L )
#define optional_CPP14_OR_GREATER ( optional_CPLUSPLUS >= 201402L )
#define optional_CPP17_OR_GREATER ( optional_CPLUSPLUS >= 201703L )
-#define optional_CPP20_OR_GREATER ( optional_CPLUSPLUS >= 202000L )
+#define optional_CPP20_OR_GREATER ( optional_CPLUSPLUS >= 202002L )
+#define optional_CPP23_OR_GREATER ( optional_CPLUSPLUS >= 202300L )
// C++ language version (represent 98 as 3):
void construct_value( value_type && v )
{
- ::new( value_ptr() ) value_type( std::move( v ) );
+ ::new( const_cast<void *>(static_cast<const volatile void *>(value_ptr())) ) value_type( std::move( v ) );
}
template< class... Args >
template< class... Args >
void emplace( Args&&... args )
{
- ::new( value_ptr() ) value_type( std::forward<Args>(args)... );
+ ::new( const_cast<void *>(static_cast<const volatile void *>(value_ptr())) ) value_type( std::forward<Args>(args)... );
}
template< class U, class... Args >
void emplace( std::initializer_list<U> il, Args&&... args )
{
- ::new( value_ptr() ) value_type( il, std::forward<Args>(args)... );
+ ::new( const_cast<void *>(static_cast<const volatile void *>(value_ptr())) ) value_type( il, std::forward<Args>(args)... );
}
#endif
void initialize( V && value )
{
assert( ! has_value() );
- contained.construct_value( std::move( value ) );
+ contained.construct_value( std::forward<V>( value ) );
has_value_ = true;
}