11 #ifndef NONSTD_OPTIONAL_LITE_HPP 12 #define NONSTD_OPTIONAL_LITE_HPP 14 #define optional_lite_MAJOR 3 15 #define optional_lite_MINOR 1 16 #define optional_lite_PATCH 1 18 #define optional_lite_VERSION optional_STRINGIFY(optional_lite_MAJOR) "." optional_STRINGIFY(optional_lite_MINOR) "." optional_STRINGIFY(optional_lite_PATCH) 20 #define optional_STRINGIFY( x ) optional_STRINGIFY_( x ) 21 #define optional_STRINGIFY_( x ) #x 25 #define optional_OPTIONAL_DEFAULT 0 26 #define optional_OPTIONAL_NONSTD 1 27 #define optional_OPTIONAL_STD 2 29 #if !defined( optional_CONFIG_SELECT_OPTIONAL ) 30 # define optional_CONFIG_SELECT_OPTIONAL ( optional_HAVE_STD_OPTIONAL ? optional_OPTIONAL_STD : optional_OPTIONAL_NONSTD ) 36 #ifndef optional_CPLUSPLUS 37 # if defined(_MSVC_LANG ) && !defined(__clang__) 38 # define optional_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG ) 40 # define optional_CPLUSPLUS __cplusplus 44 #define optional_CPP98_OR_GREATER ( optional_CPLUSPLUS >= 199711L ) 45 #define optional_CPP11_OR_GREATER ( optional_CPLUSPLUS >= 201103L ) 46 #define optional_CPP11_OR_GREATER_ ( optional_CPLUSPLUS >= 201103L ) 47 #define optional_CPP14_OR_GREATER ( optional_CPLUSPLUS >= 201402L ) 48 #define optional_CPP17_OR_GREATER ( optional_CPLUSPLUS >= 201703L ) 49 #define optional_CPP20_OR_GREATER ( optional_CPLUSPLUS >= 202000L ) 53 #define optional_CPLUSPLUS_V ( optional_CPLUSPLUS / 100 - (optional_CPLUSPLUS > 200000 ? 2000 : 1994) ) 57 #if optional_CPP17_OR_GREATER && defined(__has_include ) 58 # if __has_include( <optional> ) 59 # define optional_HAVE_STD_OPTIONAL 1 61 # define optional_HAVE_STD_OPTIONAL 0 64 # define optional_HAVE_STD_OPTIONAL 0 67 #define optional_USES_STD_OPTIONAL ( (optional_CONFIG_SELECT_OPTIONAL == optional_OPTIONAL_STD) || ((optional_CONFIG_SELECT_OPTIONAL == optional_OPTIONAL_DEFAULT) && optional_HAVE_STD_OPTIONAL) ) 73 #ifndef nonstd_lite_HAVE_IN_PLACE_TYPES 74 #define nonstd_lite_HAVE_IN_PLACE_TYPES 1 78 #if optional_CPP17_OR_GREATER 87 using std::in_place_t;
88 using std::in_place_type_t;
89 using std::in_place_index_t;
91 #define nonstd_lite_in_place_t( T) std::in_place_t 92 #define nonstd_lite_in_place_type_t( T) std::in_place_type_t<T> 93 #define nonstd_lite_in_place_index_t(K) std::in_place_index_t<K> 95 #define nonstd_lite_in_place( T) std::in_place_t{} 96 #define nonstd_lite_in_place_type( T) std::in_place_type_t<T>{} 97 #define nonstd_lite_in_place_index(K) std::in_place_index_t<K>{} 101 #else // optional_CPP17_OR_GREATER 109 struct in_place_type_tag {};
111 template< std::
size_t K >
112 struct in_place_index_tag {};
116 struct in_place_t {};
119 inline in_place_t
in_place( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
124 template< std::
size_t K >
125 inline in_place_t
in_place( detail::in_place_index_tag<K> = detail::in_place_index_tag<K>() )
131 inline in_place_t
in_place_type( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
136 template< std::
size_t K >
137 inline in_place_t
in_place_index( detail::in_place_index_tag<K> = detail::in_place_index_tag<K>() )
144 #define nonstd_lite_in_place_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> ) 145 #define nonstd_lite_in_place_type_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> ) 146 #define nonstd_lite_in_place_index_t(K) nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> ) 148 #define nonstd_lite_in_place( T) nonstd::in_place_type<T> 149 #define nonstd_lite_in_place_type( T) nonstd::in_place_type<T> 150 #define nonstd_lite_in_place_index(K) nonstd::in_place_index<K> 154 #endif // optional_CPP17_OR_GREATER 155 #endif // nonstd_lite_HAVE_IN_PLACE_TYPES 161 #if optional_USES_STD_OPTIONAL 168 using std::bad_optional_access;
172 using std::nullopt_t;
174 using std::operator==;
175 using std::operator!=;
176 using std::operator<;
177 using std::operator<=;
178 using std::operator>;
179 using std::operator>=;
184 #else // optional_USES_STD_OPTIONAL 192 #ifndef optional_CONFIG_MAX_ALIGN_HACK 193 # define optional_CONFIG_MAX_ALIGN_HACK 0 196 #ifndef optional_CONFIG_ALIGN_AS 200 #ifndef optional_CONFIG_ALIGN_AS_FALLBACK 201 # define optional_CONFIG_ALIGN_AS_FALLBACK double 206 #if defined(__clang__) 207 # pragma clang diagnostic push 208 # pragma clang diagnostic ignored "-Wundef" 209 #elif defined(__GNUC__) 210 # pragma GCC diagnostic push 211 # pragma GCC diagnostic ignored "-Wundef" 215 #define optional_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) ) 230 #if defined(_MSC_VER ) && !defined(__clang__) 231 # define optional_COMPILER_MSVC_VER (_MSC_VER ) 232 # define optional_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) ) 234 # define optional_COMPILER_MSVC_VER 0 235 # define optional_COMPILER_MSVC_VERSION 0 238 #define optional_COMPILER_VERSION( major, minor, patch ) ( 10 * (10 * major + minor ) + patch ) 240 #if defined(__GNUC__) && !defined(__clang__) 241 # define optional_COMPILER_GNUC_VERSION optional_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 243 # define optional_COMPILER_GNUC_VERSION 0 246 #if defined(__clang__) 247 # define optional_COMPILER_CLANG_VERSION optional_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) 249 # define optional_COMPILER_CLANG_VERSION 0 252 #if optional_BETWEEN(optional_COMPILER_MSVC_VERSION, 70, 140 ) 253 # pragma warning( push ) 254 # pragma warning( disable: 4345 ) // initialization behavior changed 257 #if optional_BETWEEN(optional_COMPILER_MSVC_VERSION, 70, 150 ) 258 # pragma warning( push ) 259 # pragma warning( disable: 4814 ) // in C++14 'constexpr' will not imply 'const' 264 #define optional_HAVE(FEATURE) ( optional_HAVE_##FEATURE ) 267 # define optional_HAS_CPP0X _HAS_CPP0X 269 # define optional_HAS_CPP0X 0 274 #if optional_COMPILER_MSVC_VER >= 1900 275 # undef optional_CPP11_OR_GREATER 276 # define optional_CPP11_OR_GREATER 1 279 #define optional_CPP11_90 (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1500) 280 #define optional_CPP11_100 (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1600) 281 #define optional_CPP11_110 (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1700) 282 #define optional_CPP11_120 (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1800) 283 #define optional_CPP11_140 (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1900) 284 #define optional_CPP11_141 (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1910) 286 #define optional_CPP14_000 (optional_CPP14_OR_GREATER) 287 #define optional_CPP17_000 (optional_CPP17_OR_GREATER) 291 #define optional_HAVE_CONSTEXPR_11 optional_CPP11_140 292 #define optional_HAVE_NOEXCEPT optional_CPP11_140 293 #define optional_HAVE_NULLPTR optional_CPP11_100 294 #define optional_HAVE_REF_QUALIFIER optional_CPP11_140 298 #define optional_HAVE_CONSTEXPR_14 optional_CPP14_000 306 #define optional_HAVE_CONDITIONAL optional_CPP11_120 307 #define optional_HAVE_REMOVE_CV optional_CPP11_120 308 #define optional_HAVE_TYPE_TRAITS optional_CPP11_90 310 #define optional_HAVE_TR1_TYPE_TRAITS (!! optional_COMPILER_GNUC_VERSION ) 311 #define optional_HAVE_TR1_ADD_POINTER (!! optional_COMPILER_GNUC_VERSION ) 315 #if optional_HAVE( CONSTEXPR_11 ) 316 # define optional_constexpr constexpr 318 # define optional_constexpr 321 #if optional_HAVE( CONSTEXPR_14 ) 322 # define optional_constexpr14 constexpr 324 # define optional_constexpr14 327 #if optional_HAVE( NOEXCEPT ) 328 # define optional_noexcept noexcept 330 # define optional_noexcept 333 #if optional_HAVE( NULLPTR ) 334 # define optional_nullptr nullptr 336 # define optional_nullptr NULL 339 #if optional_HAVE( REF_QUALIFIER ) 340 # define optional_ref_qual & 341 # define optional_refref_qual && 343 # define optional_ref_qual 344 # define optional_refref_qual 349 #if optional_CPP11_OR_GREATER 350 # include <functional> 353 #if optional_HAVE( INITIALIZER_LIST ) 354 # include <initializer_list> 357 #if optional_HAVE( TYPE_TRAITS ) 358 # include <type_traits> 359 #elif optional_HAVE( TR1_TYPE_TRAITS ) 360 # include <tr1/type_traits> 365 #if optional_CPP11_OR_GREATER 367 # define optional_REQUIRES_T(...) \ 368 , typename = typename std::enable_if<__VA_ARGS__>::type 370 # define optional_REQUIRES_R(R, ...) \ 371 typename std::enable_if<__VA_ARGS__, R>::type 373 # define optional_REQUIRES_A(...) \ 374 , typename std::enable_if<__VA_ARGS__, void*>::type = optional_nullptr 382 namespace nonstd {
namespace optional_lite {
386 #if optional_HAVE( CONDITIONAL ) 387 using std::conditional;
390 template<
typename T,
typename F >
struct conditional<false, T, F> {
typedef F
type; };
391 #endif // optional_HAVE_CONDITIONAL 395 #if optional_CPP11_OR_GREATER 401 template<
typename T >
404 typedef typename std::remove_cv< typename std::remove_reference<T>::type >::type type;
409 #endif // optional_CPP11_OR_GREATER 413 template<
typename T >
422 template<
typename Head,
typename Tail >
429 #if optional_CONFIG_MAX_ALIGN_HACK 433 #define optional_UNIQUE( name ) optional_UNIQUE2( name, __LINE__ ) 434 #define optional_UNIQUE2( name, line ) optional_UNIQUE3( name, line ) 435 #define optional_UNIQUE3( name, line ) name ## line 437 #define optional_ALIGN_TYPE( type ) \ 438 type optional_UNIQUE( _t ); struct_t< type > optional_UNIQUE( _st ) 440 template<
typename T >
461 #ifdef HAVE_LONG_LONG 467 Unknown ( * optional_UNIQUE(_) )( Unknown );
468 Unknown * Unknown::* optional_UNIQUE(_);
469 Unknown ( Unknown::* optional_UNIQUE(_) )( Unknown );
471 struct_t< Unknown ( * )( Unknown) > optional_UNIQUE(_);
472 struct_t< Unknown * Unknown::* > optional_UNIQUE(_);
473 struct_t< Unknown ( Unknown::* )(Unknown) > optional_UNIQUE(_);
476 #undef optional_UNIQUE 477 #undef optional_UNIQUE2 478 #undef optional_UNIQUE3 480 #undef optional_ALIGN_TYPE 482 #elif defined( optional_CONFIG_ALIGN_AS ) // optional_CONFIG_MAX_ALIGN_HACK 486 #define optional_ALIGN_AS( unused ) \ 487 optional_CONFIG_ALIGN_AS 489 #else // optional_CONFIG_MAX_ALIGN_HACK 493 #define optional_ALIGN_AS( to_align ) \ 494 typename type_of_size< alignment_types, alignment_of< to_align >::value >::type 496 template<
typename T >
499 template<
typename T >
507 template<
size_t A,
size_t S >
510 enum { value = A < S ? A : S };
513 template<
typename T >
520 template<
typename List,
size_t N >
524 N ==
sizeof(
typename List::head ),
535 template<
typename T>
538 #define optional_ALIGN_TYPE( type ) \ 539 typelist< type , typelist< struct_t< type > 565 > > > > > > > > > > > > > >
566 > > > > > > > > > > > > > >
570 #undef optional_ALIGN_TYPE 572 #endif // optional_CONFIG_MAX_ALIGN_HACK 576 template<
typename T >
596 #if optional_CPP11_OR_GREATER 608 template< class... Args >
609 void emplace( Args&&... args )
614 template< class U, class... Args >
615 void emplace( std::initializer_list<U> il, Args&&... args )
629 return as<value_type>();
634 return as<value_type>();
647 #if optional_CPP11_OR_GREATER 651 return std::move(
value() );
656 return std::move(
value() );
661 #if optional_CPP11_OR_GREATER 663 using aligned_storage_t =
typename std::aligned_storage<
sizeof(
value_type),
alignof(
value_type) >::type;
664 aligned_storage_t
data;
666 #elif optional_CONFIG_MAX_ALIGN_HACK 668 typedef struct {
unsigned char data[
sizeof(
value_type) ]; } aligned_storage_t;
671 aligned_storage_t
data;
679 # undef optional_ALIGN_AS 681 #endif // optional_CONFIG_MAX_ALIGN_HACK 693 template <
typename U>
696 return reinterpret_cast<U*>(
ptr() );
699 template <
typename U>
702 return reinterpret_cast<U const *>(
ptr() );
716 #if optional_HAVE( CONSTEXPR_11 ) 720 const nullopt_t
nullopt(( nullopt_t::init() ));
729 : logic_error(
"bad optional access" ) {}
734 template<
typename T>
740 typedef void (
optional::*safe_bool)()
const;
749 : has_value_( false )
755 : has_value_(
false )
763 true || std::is_copy_constructible<T>::value
767 : has_value_( other.has_value() )
769 if ( other.has_value() )
770 contained.construct_value( other.contained.value() );
773 #if optional_CPP11_OR_GREATER 778 true || std::is_move_constructible<T>::value
780 ) noexcept( std::is_nothrow_move_constructible<T>::value )
781 : has_value_( other.has_value() )
783 if ( other.has_value() )
784 contained.construct_value( std::move( other.contained.value() ) );
788 template<
typename U >
791 std::is_constructible<T, U const &>::value
800 && !std::is_convertible< U const & , T>::value
803 : has_value_( other.has_value() )
805 if ( other.has_value() )
806 contained.construct_value( other.contained.value() );
808 #endif // optional_CPP11_OR_GREATER 811 template<
typename U >
815 std::is_constructible<T, U const &>::value
824 && std::is_convertible< U const & , T>::value
828 : has_value_( other.has_value() )
830 if ( other.has_value() )
831 contained.construct_value( other.contained.value() );
834 #if optional_CPP11_OR_GREATER 837 template<
typename U >
840 std::is_constructible<T, U const &>::value
849 && !std::is_convertible< U &&, T>::value
852 : has_value_( other.has_value() )
854 if ( other.has_value() )
855 contained.construct_value( std::move( other.contained.value() ) );
859 template<
typename U >
862 std::is_constructible<T, U const &>::value
871 && std::is_convertible< U &&, T>::value
874 : has_value_( other.has_value() )
876 if ( other.has_value() )
877 contained.construct_value( std::move( other.contained.value() ) );
881 template<
typename... Args
883 std::is_constructible<T, Args&&...>::value
888 , contained( T( std::forward<Args>(args)...) )
892 template<
typename U,
typename... Args
894 std::is_constructible<T, std::initializer_list<U>&, Args&&...>::
value 899 , contained( T( il, std::forward<Args>(args)...) )
903 template<
typename U = value_type >
906 std::is_constructible<T, U&&>::value
908 && !std::is_same<
typename std20::remove_cvref<U>::type, optional<T>>::
value 909 && !std::is_convertible<U&&, T>::value
913 , contained( std::forward<U>(
value ) )
917 template<
typename U = value_type >
920 std::is_constructible<T, U&&>::value
922 && !std::is_same<
typename std20::remove_cvref<U>::type, optional<T>>::
value 923 && std::is_convertible<U&&, T>::value
927 , contained( std::forward<U>(
value ) )
930 #else // optional_CPP11_OR_GREATER 938 #endif // optional_CPP11_OR_GREATER 945 contained.destruct_value();
958 #if optional_CPP11_OR_GREATER 967 std::is_nothrow_move_assignable<T>::
value 968 && std::is_nothrow_move_constructible<T>::
value 974 if ( has_value() ==
true && other.
has_value() == false ) reset();
975 else if ( has_value() ==
false && other.
has_value() == true ) initialize( *other );
976 else if ( has_value() ==
true && other.
has_value() == true ) contained.
value() = *other;
980 #if optional_CPP11_OR_GREATER 989 operator=(
optional && other ) noexcept
991 if ( has_value() ==
true && other.
has_value() == false ) reset();
992 else if ( has_value() ==
false && other.
has_value() == true ) initialize( std::move( *other ) );
993 else if ( has_value() ==
true && other.
has_value() == true ) contained.
value() = std::move( *other );
998 template<
typename U = T >
1001 std::is_constructible<T , U>::value
1002 && std::is_assignable<T&, U>::value
1004 && !std::is_same<
typename std20::remove_cvref<U>::type,
optional<T>>::
value 1007 operator=( U &&
value )
1009 if ( has_value() ) contained.value() = std::forward<U>(
value );
1010 else initialize( T( std::forward<U>(
value ) ) );
1014 #else // optional_CPP11_OR_GREATER 1017 template<
typename U >
1020 if ( has_value() ) contained.
value() =
value;
1021 else initialize( T(
value ) );
1025 #endif // optional_CPP11_OR_GREATER 1028 template<
typename U >
1029 #if optional_CPP11_OR_GREATER 1030 optional_REQUIRES_R(
1032 std::is_constructible< T , U const &>::value
1033 && std::is_assignable< T&, U const &>::value
1049 #endif // optional_CPP11_OR_GREATER 1055 #if optional_CPP11_OR_GREATER 1058 template<
typename U >
1059 optional_REQUIRES_R(
1061 std::is_constructible< T , U>::value
1062 && std::is_assignable< T&, U>::value
1078 return *
this =
optional( std::move( other ) );
1082 template<
typename... Args
1083 optional_REQUIRES_T(
1084 std::is_constructible<T, Args&&...>::value
1087 T& emplace( Args&&... args )
1090 contained.emplace( std::forward<Args>(args)... );
1092 return contained.value();
1096 template<
typename U,
typename... Args
1097 optional_REQUIRES_T(
1098 std::is_constructible<T, std::initializer_list<U>&, Args&&...>::
value 1101 T& emplace( std::initializer_list<U> il, Args&&... args )
1104 contained.emplace( il, std::forward<Args>(args)... );
1106 return contained.value();
1109 #endif // optional_CPP11_OR_GREATER 1114 #if optional_CPP11_OR_GREATER 1116 std::is_nothrow_move_constructible<T>::value
1117 && noexcept(
std::swap( std::declval<T&>(), std::declval<T&>() ) )
1122 if ( has_value() ==
true && other.
has_value() == true ) {
swap( **
this, *other ); }
1123 else if ( has_value() ==
false && other.
has_value() == true ) { initialize( *other ); other.
reset(); }
1124 else if ( has_value() ==
true && other.
has_value() == false ) { other.initialize( **
this ); reset(); }
1131 return assert( has_value() ),
1132 contained.value_ptr();
1137 return assert( has_value() ),
1138 contained.value_ptr();
1143 return assert( has_value() ),
1149 return assert( has_value() ),
1153 #if optional_CPP11_OR_GREATER 1157 return std::move( **
this );
1162 return std::move( **
this );
1167 #if optional_CPP11_OR_GREATER 1175 return has_value() ? &optional::this_type_does_not_support_comparisons : 0;
1186 if ( ! has_value() )
1189 return contained.value();
1194 if ( ! has_value() )
1197 return contained.value();
1200 #if optional_HAVE( REF_QUALIFIER ) 1204 return std::move(
value() );
1209 return std::move(
value() );
1214 #if optional_CPP11_OR_GREATER 1216 template<
typename U >
1219 return has_value() ? contained.value() : static_cast<T>(std::forward<U>( v ) );
1222 template<
typename U >
1225 return has_value() ? std::move( contained.value() ) : static_cast<T>(std::forward<U>( v ) );
1230 template<
typename U >
1233 return has_value() ? contained.value() : static_cast<value_type>( v );
1236 #endif // optional_CPP11_OR_GREATER 1243 contained.destruct_value();
1249 void this_type_does_not_support_comparisons()
const {}
1251 template<
typename V >
1252 void initialize( V
const &
value )
1254 assert( ! has_value() );
1255 contained.construct_value(
value );
1259 #if optional_CPP11_OR_GREATER 1260 template<
typename V >
1261 void initialize( V &&
value )
1263 assert( ! has_value() );
1264 contained.construct_value( std::move(
value ) );
1272 detail::storage_t< value_type > contained;
1278 template<
typename T,
typename U >
1281 return bool(x) != bool(y) ? false : !bool( x ) ? true : *x == *y;
1284 template<
typename T,
typename U >
1290 template<
typename T,
typename U >
1293 return (!y) ? false : (!x) ?
true : *x < *y;
1296 template<
typename T,
typename U >
1302 template<
typename T,
typename U >
1308 template<
typename T,
typename U >
1316 template<
typename T >
1322 template<
typename T >
1328 template<
typename T >
1334 template<
typename T >
1340 template<
typename T >
1346 template<
typename T >
1352 template<
typename T >
1358 template<
typename T >
1364 template<
typename T >
1370 template<
typename T >
1376 template<
typename T >
1382 template<
typename T >
1390 template<
typename T,
typename U >
1393 return bool(x) ? *x == v :
false;
1396 template<
typename T,
typename U >
1399 return bool(x) ? v == *x :
false;
1402 template<
typename T,
typename U >
1405 return bool(x) ? *x != v :
true;
1408 template<
typename T,
typename U >
1411 return bool(x) ? v != *x :
true;
1414 template<
typename T,
typename U >
1417 return bool(x) ? *x < v :
true;
1420 template<
typename T,
typename U >
1423 return bool(x) ? v < *x :
false;
1426 template<
typename T,
typename U >
1429 return bool(x) ? *x <= v :
true;
1432 template<
typename T,
typename U >
1435 return bool(x) ? v <= *x :
false;
1438 template<
typename T,
typename U >
1441 return bool(x) ? *x > v :
false;
1444 template<
typename T,
typename U >
1447 return bool(x) ? v > *x :
true;
1450 template<
typename T,
typename U >
1453 return bool(x) ? *x >= v :
false;
1456 template<
typename T,
typename U >
1459 return bool(x) ? v >= *x :
true;
1464 template<
typename T >
1466 #if optional_CPP11_OR_GREATER 1467 noexcept( noexcept( x.
swap(y) ) )
1473 #if optional_CPP11_OR_GREATER 1475 template<
typename T >
1481 template<
typename T,
typename...Args >
1487 template<
typename T,
typename U,
typename... Args >
1495 template<
typename T >
1501 #endif // optional_CPP11_OR_GREATER 1505 using namespace optional_lite;
1509 #if optional_CPP11_OR_GREATER 1521 return bool( v ) ? hash<T>()( *v ) : 0;
1527 #endif // optional_CPP11_OR_GREATER 1529 #if defined(__clang__) 1530 # pragma clang diagnostic pop 1531 #elif defined(__GNUC__) 1532 # pragma GCC diagnostic pop 1535 #endif // optional_USES_STD_OPTIONAL 1537 #endif // NONSTD_OPTIONAL_LITE_HPP
conditional< N==sizeof(typename List::head), typename List::head, typename type_of_size< typename List::tail, N >::type >::type type
#define nonstd_lite_in_place_t( T)
#define optional_noexcept
#define optional_ref_qual
value_type const * value_ptr() const
optional_constexpr bool operator==(optional< T > const &x, optional< U > const &y)
void swap(optional< T > &x, optional< T > &y)
optional_constexpr14 value_type & value() optional_ref_qual
optional_constexpr14 value_type & operator *() optional_ref_qual
typedef optional_ALIGN_AS(value_type) align_as_type
optional< T > make_optional(T const &value)
optional_constexpr14 value_type const & value() const optional_ref_qual
void reset() optional_noexcept
typedef optional_ALIGN_TYPE(char)
optional_constexpr nullopt_t(init)
void const * ptr() const optional_noexcept
optional & operator=(nullopt_t) optional_noexcept
optional_CONFIG_ALIGN_AS_FALLBACK type
in_place_t in_place_index(detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
optional(value_type const &value)
void construct_value(value_type const &v)
optional & operator=(U const &value)
std::size_t hash(T const &v)
optional & operator=(optional< U > const &other)
optional_constexpr bool operator<=(optional< T > const &x, optional< U > const &y)
optional_constexpr14 value_type * operator ->()
storage_t(value_type const &v)
#define optional_CONFIG_ALIGN_AS_FALLBACK
optional_constexpr value_type const & operator *() const optional_ref_qual
value_type & value() optional_ref_qual
optional_constexpr14 optional(optional const &other)
optional_constexpr bool operator>(optional< T > const &x, optional< U > const &y)
#define optional_refref_qual
optional_constexpr bool operator<(optional< T > const &x, optional< U > const &y)
optional_constexpr bool operator!=(optional< T > const &x, optional< U > const &y)
optional_constexpr value_type value_or(U const &v) const
value_type const & value() const optional_ref_qual
#define optional_CPP11_OR_GREATER
void * ptr() optional_noexcept
void swap(optional &other)
optional_constexpr optional(nullopt_t) optional_noexcept
optional_constexpr optional() optional_noexcept
optional(optional< U > const &other)
#define optional_constexpr14
optional & operator=(optional const &other)
#define nonstd_lite_in_place( T)
in_place_t in_place_type(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
C++03 constructed union to hold value.
optional_constexpr bool operator>=(optional< T > const &x, optional< U > const &y)
optional_constexpr value_type const * operator ->() const
const nullopt_t nullopt((nullopt_t::init()))
#define optional_constexpr
in_place_t in_place(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
optional_constexpr bool has_value() const optional_noexcept