10 #ifndef NONSTD_VARIANT_LITE_HPP 11 #define NONSTD_VARIANT_LITE_HPP 13 #define variant_lite_MAJOR 1 14 #define variant_lite_MINOR 1 15 #define variant_lite_PATCH 0 17 #define variant_lite_VERSION variant_STRINGIFY(variant_lite_MAJOR) "." variant_STRINGIFY(variant_lite_MINOR) "." variant_STRINGIFY(variant_lite_PATCH) 19 #define variant_STRINGIFY( x ) variant_STRINGIFY_( x ) 20 #define variant_STRINGIFY_( x ) #x 24 #define variant_VARIANT_DEFAULT 0 25 #define variant_VARIANT_NONSTD 1 26 #define variant_VARIANT_STD 2 28 #if !defined( variant_CONFIG_SELECT_VARIANT ) 29 # define variant_CONFIG_SELECT_VARIANT ( variant_HAVE_STD_VARIANT ? variant_VARIANT_STD : variant_VARIANT_NONSTD ) 32 #ifndef variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 33 # define variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 0 36 #ifndef variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 37 # define variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 0 42 #ifndef variant_CONFIG_NO_EXCEPTIONS 43 # if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) 44 # define variant_CONFIG_NO_EXCEPTIONS 0 46 # define variant_CONFIG_NO_EXCEPTIONS 1 53 #ifndef variant_CPLUSPLUS 54 # if defined(_MSVC_LANG ) && !defined(__clang__) 55 # define variant_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG ) 57 # define variant_CPLUSPLUS __cplusplus 61 #define variant_CPP98_OR_GREATER ( variant_CPLUSPLUS >= 199711L ) 62 #define variant_CPP11_OR_GREATER ( variant_CPLUSPLUS >= 201103L ) 63 #define variant_CPP11_OR_GREATER_ ( variant_CPLUSPLUS >= 201103L ) 64 #define variant_CPP14_OR_GREATER ( variant_CPLUSPLUS >= 201402L ) 65 #define variant_CPP17_OR_GREATER ( variant_CPLUSPLUS >= 201703L ) 66 #define variant_CPP20_OR_GREATER ( variant_CPLUSPLUS >= 202000L ) 70 #if variant_CPP17_OR_GREATER && defined(__has_include ) 71 # if __has_include( <variant> ) 72 # define variant_HAVE_STD_VARIANT 1 74 # define variant_HAVE_STD_VARIANT 0 77 # define variant_HAVE_STD_VARIANT 0 80 #define variant_USES_STD_VARIANT ( (variant_CONFIG_SELECT_VARIANT == variant_VARIANT_STD) || ((variant_CONFIG_SELECT_VARIANT == variant_VARIANT_DEFAULT) && variant_HAVE_STD_VARIANT) ) 86 #ifndef nonstd_lite_HAVE_IN_PLACE_TYPES 87 #define nonstd_lite_HAVE_IN_PLACE_TYPES 1 91 #if variant_CPP17_OR_GREATER 100 using std::in_place_t;
101 using std::in_place_type_t;
102 using std::in_place_index_t;
104 #define nonstd_lite_in_place_t( T) std::in_place_t 105 #define nonstd_lite_in_place_type_t( T) std::in_place_type_t<T> 106 #define nonstd_lite_in_place_index_t(K) std::in_place_index_t<K> 108 #define nonstd_lite_in_place( T) std::in_place_t{} 109 #define nonstd_lite_in_place_type( T) std::in_place_type_t<T>{} 110 #define nonstd_lite_in_place_index(K) std::in_place_index_t<K>{} 114 #else // variant_CPP17_OR_GREATER 122 struct in_place_type_tag {};
124 template< std::
size_t K >
125 struct in_place_index_tag {};
129 struct in_place_t {};
132 inline in_place_t
in_place( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
137 template< std::
size_t K >
138 inline in_place_t
in_place( detail::in_place_index_tag<K> = detail::in_place_index_tag<K>() )
144 inline in_place_t
in_place_type( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
149 template< std::
size_t K >
150 inline in_place_t
in_place_index( detail::in_place_index_tag<K> = detail::in_place_index_tag<K>() )
157 #define nonstd_lite_in_place_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> ) 158 #define nonstd_lite_in_place_type_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> ) 159 #define nonstd_lite_in_place_index_t(K) nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> ) 161 #define nonstd_lite_in_place( T) nonstd::in_place_type<T> 162 #define nonstd_lite_in_place_type( T) nonstd::in_place_type<T> 163 #define nonstd_lite_in_place_index(K) nonstd::in_place_index<K> 167 #endif // variant_CPP17_OR_GREATER 168 #endif // nonstd_lite_HAVE_IN_PLACE_TYPES 174 #if variant_USES_STD_VARIANT 176 #include <functional> 179 #if ! variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 180 # define variant_size_V(T) nonstd::variant_size<T>::value 183 #if ! variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 184 # define variant_alternative_T(K,T) typename nonstd::variant_alternative<K,T >::type 190 using std::monostate;
191 using std::bad_variant_access;
192 using std::variant_size;
193 using std::variant_size_v;
194 using std::variant_alternative;
195 using std::variant_alternative_t;
202 using std::operator==;
203 using std::operator!=;
204 using std::operator<;
205 using std::operator<=;
206 using std::operator>;
207 using std::operator>=;
213 #else // variant_USES_STD_VARIANT 220 #if variant_CONFIG_NO_EXCEPTIONS 223 # include <stdexcept> 228 #define variant_CONFIG_MAX_TYPE_COUNT 16 229 #define variant_CONFIG_MAX_VISITOR_ARG_COUNT 5 233 #ifndef variant_CONFIG_MAX_ALIGN_HACK 234 # define variant_CONFIG_MAX_ALIGN_HACK 0 237 #ifndef variant_CONFIG_ALIGN_AS 241 #ifndef variant_CONFIG_ALIGN_AS_FALLBACK 242 # define variant_CONFIG_ALIGN_AS_FALLBACK double 246 #define variant_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) ) 261 #if defined(_MSC_VER ) && !defined(__clang__) 262 # define variant_COMPILER_MSVC_VER (_MSC_VER ) 263 # define variant_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) ) 265 # define variant_COMPILER_MSVC_VER 0 266 # define variant_COMPILER_MSVC_VERSION 0 269 #define variant_COMPILER_VERSION( major, minor, patch ) ( 10 * ( 10 * (major) + (minor) ) + (patch) ) 271 #if defined(__clang__) 272 # define variant_COMPILER_CLANG_VERSION variant_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) 274 # define variant_COMPILER_CLANG_VERSION 0 277 #if defined(__GNUC__) && !defined(__clang__) 278 # define variant_COMPILER_GNUC_VERSION variant_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 280 # define variant_COMPILER_GNUC_VERSION 0 283 #if variant_BETWEEN( variant_COMPILER_MSVC_VER, 1300, 1900 ) 284 # pragma warning( push ) 285 # pragma warning( disable: 4345 ) // initialization behavior changed 290 #define variant_HAVE( feature ) ( variant_HAVE_##feature ) 293 # define variant_HAS_CPP0X _HAS_CPP0X 295 # define variant_HAS_CPP0X 0 300 #if variant_COMPILER_MSVC_VER >= 1900 301 # undef variant_CPP11_OR_GREATER 302 # define variant_CPP11_OR_GREATER 1 305 #define variant_CPP11_90 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1500) 306 #define variant_CPP11_100 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1600) 307 #define variant_CPP11_110 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1700) 308 #define variant_CPP11_120 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1800) 309 #define variant_CPP11_140 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1900) 310 #define variant_CPP11_141 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1910) 312 #define variant_CPP14_000 (variant_CPP14_OR_GREATER) 313 #define variant_CPP17_000 (variant_CPP17_OR_GREATER) 317 #define variant_HAVE_CONSTEXPR_11 variant_CPP11_140 318 #define variant_HAVE_INITIALIZER_LIST variant_CPP11_120 319 #define variant_HAVE_NOEXCEPT variant_CPP11_140 320 #define variant_HAVE_NULLPTR variant_CPP11_100 321 #define variant_HAVE_OVERRIDE variant_CPP11_140 325 #define variant_HAVE_CONSTEXPR_14 variant_CPP14_000 333 #define variant_HAVE_CONDITIONAL variant_CPP11_120 334 #define variant_HAVE_REMOVE_CV variant_CPP11_120 335 #define variant_HAVE_STD_ADD_POINTER variant_CPP11_90 336 #define variant_HAVE_TYPE_TRAITS variant_CPP11_90 338 #define variant_HAVE_TR1_TYPE_TRAITS (!! variant_COMPILER_GNUC_VERSION ) 339 #define variant_HAVE_TR1_ADD_POINTER (!! variant_COMPILER_GNUC_VERSION ) 343 #if variant_HAVE_CONSTEXPR_11 344 # define variant_constexpr constexpr 346 # define variant_constexpr 349 #if variant_HAVE_CONSTEXPR_14 350 # define variant_constexpr14 constexpr 352 # define variant_constexpr14 355 #if variant_HAVE_NOEXCEPT 356 # define variant_noexcept noexcept 358 # define variant_noexcept 361 #if variant_HAVE_NULLPTR 362 # define variant_nullptr nullptr 364 # define variant_nullptr NULL 367 #if variant_HAVE_OVERRIDE 368 # define variant_override override 370 # define variant_override 375 #if variant_CPP11_OR_GREATER 376 # include <functional> 379 #if variant_HAVE_INITIALIZER_LIST 380 # include <initializer_list> 383 #if variant_HAVE_TYPE_TRAITS 384 # include <type_traits> 385 #elif variant_HAVE_TR1_TYPE_TRAITS 386 # include <tr1/type_traits> 391 #if variant_CPP11_OR_GREATER 393 #define variant_REQUIRES_0(...) \ 394 template< bool B = (__VA_ARGS__), typename std::enable_if<B, int>::type = 0 > 396 #define variant_REQUIRES_T(...) \ 397 , typename = typename std::enable_if< (__VA_ARGS__), nonstd::variants::detail::enabler >::type 399 #define variant_REQUIRES_R(R, ...) \ 400 typename std::enable_if< (__VA_ARGS__), R>::type 402 #define variant_REQUIRES_A(...) \ 403 , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr 417 #if variant_HAVE_STD_ADD_POINTER 419 using std::add_pointer;
421 #elif variant_HAVE_TR1_ADD_POINTER 423 using std::tr1::add_pointer;
435 #endif // variant_HAVE_STD_ADD_POINTER 437 #if variant_HAVE_REMOVE_CV 439 using std::remove_cv;
455 #endif // variant_HAVE_REMOVE_CV 457 #if variant_HAVE_CONDITIONAL 459 using std::conditional;
463 template<
bool Cond,
class Then,
class Else >
466 template<
class Then,
class Else >
469 template<
class Then,
class Else >
472 #endif // variant_HAVE_CONDITIONAL 480 #if variant_CPP17_OR_GREATER 482 using std::is_swappable;
483 using std::is_nothrow_swappable;
485 #elif variant_CPP11_OR_GREATER 493 template<
typename T,
typename = decltype( swap( std::declval<T&>(), std::declval<T&>() ) ) >
494 static std::true_type test(
int );
497 static std::false_type test(...);
500 struct is_nothrow_swappable
504 template<
typename T >
505 static constexpr
bool test()
507 return noexcept(
swap( std::declval<T&>(), std::declval<T&>() ) );
510 template<
typename T >
511 static auto test(
int ) -> std::integral_constant<bool, test<T>()>{}
514 static std::false_type test(...);
521 template<
typename T >
522 struct is_swappable : decltype( detail::is_swappable::test<T>(0) ){};
524 template<
typename T >
525 struct is_nothrow_swappable : decltype( detail::is_nothrow_swappable::test<T>(0) ){};
527 #endif // variant_CPP17_OR_GREATER 541 #define variant_TL1( T1 ) detail::typelist< T1, detail::nulltype > 542 #define variant_TL2( T1, T2) detail::typelist< T1, variant_TL1( T2) > 543 #define variant_TL3( T1, T2, T3) detail::typelist< T1, variant_TL2( T2, T3) > 544 #define variant_TL4( T1, T2, T3, T4) detail::typelist< T1, variant_TL3( T2, T3, T4) > 545 #define variant_TL5( T1, T2, T3, T4, T5) detail::typelist< T1, variant_TL4( T2, T3, T4, T5) > 546 #define variant_TL6( T1, T2, T3, T4, T5, T6) detail::typelist< T1, variant_TL5( T2, T3, T4, T5, T6) > 547 #define variant_TL7( T1, T2, T3, T4, T5, T6, T7) detail::typelist< T1, variant_TL6( T2, T3, T4, T5, T6, T7) > 548 #define variant_TL8( T1, T2, T3, T4, T5, T6, T7, T8) detail::typelist< T1, variant_TL7( T2, T3, T4, T5, T6, T7, T8) > 549 #define variant_TL9( T1, T2, T3, T4, T5, T6, T7, T8, T9) detail::typelist< T1, variant_TL8( T2, T3, T4, T5, T6, T7, T8, T9) > 550 #define variant_TL10( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) detail::typelist< T1, variant_TL9( T2, T3, T4, T5, T6, T7, T8, T9, T10) > 551 #define variant_TL11( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) detail::typelist< T1, variant_TL10( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) > 552 #define variant_TL12( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) detail::typelist< T1, variant_TL11( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) > 553 #define variant_TL13( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) detail::typelist< T1, variant_TL12( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) > 554 #define variant_TL14( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) detail::typelist< T1, variant_TL13( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) > 555 #define variant_TL15( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) detail::typelist< T1, variant_TL14( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) > 556 #define variant_TL16( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) detail::typelist< T1, variant_TL15( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) > 572 template<
class U >
inline TX<T> operator* ( U
const & )
const {
return TX<T>(); }
573 template<
class U >
inline TX<T> operator/ ( U
const & )
const {
return TX<T>(); }
575 template<
class U >
inline TX<T> operator% ( U
const & )
const {
return TX<T>(); }
576 template<
class U >
inline TX<T> operator+ ( U
const & )
const {
return TX<T>(); }
577 template<
class U >
inline TX<T> operator- ( U
const & )
const {
return TX<T>(); }
583 inline bool operator< ( T
const & )
const {
return false; }
585 template<
class U >
inline TX<T> operator& ( U
const & )
const {
return TX<T>(); }
586 template<
class U >
inline TX<T> operator| ( U
const & )
const {
return TX<T>(); }
587 template<
class U >
inline TX<T> operator^ ( U
const & )
const {
return TX<T>(); }
589 template<
class U >
inline TX<T> operator&&( U
const & )
const {
return TX<T>(); }
613 template<
class Head,
class Tail >
622 template<
class List >
628 enum V { value = 0 } ;
632 template<
class Head,
class Tail >
641 enum V { value = (
sizeof( Head ) > tail_value) ?
sizeof( Head ) : std::size_t( tail_value ) } ;
646 #if variant_CPP11_OR_GREATER 650 template<
class List >
651 struct typelist_max_alignof;
654 struct typelist_max_alignof<
nulltype >
656 enum V { value = 0 } ;
659 template<
class Head,
class Tail >
660 struct typelist_max_alignof<
typelist<Head, Tail> >
663 enum TV { tail_value = size_t( typelist_max_alignof<Tail>::value ) };
666 enum V { value = (
alignof( Head ) > tail_value) ?
alignof( Head ) : std::size_t( tail_value ) };
673 template<
class List >
676 enum V { value = 1 };
699 template<
class Head,
class Tail >
707 template<
class List,
class T >
713 enum V { value = -1 };
716 template<
class Tail,
class T >
719 enum V { value = 0 };
722 template<
class Head,
class Tail,
class T >
729 enum V { value = nextVal == -1 ? -1 : 1 + nextVal } ;
734 template<
class List, std::
size_t i>
737 template<
class Head,
class Tail >
743 template<
class Head,
class Tail, std::
size_t i >
749 #if variant_CONFIG_MAX_ALIGN_HACK 753 #define variant_UNIQUE( name ) variant_UNIQUE2( name, __LINE__ ) 754 #define variant_UNIQUE2( name, line ) variant_UNIQUE3( name, line ) 755 #define variant_UNIQUE3( name, line ) name ## line 757 #define variant_ALIGN_TYPE( type ) \ 758 type variant_UNIQUE( _t ); struct_t< type > variant_UNIQUE( _st ) 781 #ifdef HAVE_LONG_LONG 787 Unknown ( * variant_UNIQUE(_) )( Unknown );
788 Unknown * Unknown::* variant_UNIQUE(_);
789 Unknown ( Unknown::* variant_UNIQUE(_) )( Unknown );
796 #undef variant_UNIQUE 797 #undef variant_UNIQUE2 798 #undef variant_UNIQUE3 800 #undef variant_ALIGN_TYPE 802 #elif defined( variant_CONFIG_ALIGN_AS ) // variant_CONFIG_MAX_ALIGN_HACK 806 #define variant_ALIGN_AS( unused ) \ 807 variant_CONFIG_ALIGN_AS 809 #else // variant_CONFIG_MAX_ALIGN_HACK 813 #define variant_ALIGN_AS( to_align ) \ 814 typename detail::type_of_size< detail::alignment_types, detail::alignment_of< to_align >::value >::type 816 template<
typename T >
819 template<
typename T >
827 template<
size_t A,
size_t S >
830 enum V { value = A < S ? A : S };
833 template<
typename T >
840 template<
typename List,
size_t N >
844 N ==
sizeof(
typename List::head ),
855 template<
typename T>
858 #define variant_ALIGN_TYPE( type ) \ 859 typelist< type , typelist< struct_t< type > 885 > > > > > > > > > > > > > >
886 > > > > > > > > > > > > > >
890 #undef variant_ALIGN_TYPE 892 #endif // variant_CONFIG_MAX_ALIGN_HACK 894 #if variant_CPP11_OR_GREATER 896 template<
typename T>
897 inline std::size_t hash( T
const & v )
899 return std::hash<T>()( v );
902 inline std::size_t hash( T0
const & ) {
return 0; }
903 inline std::size_t hash( T1
const & ) {
return 0; }
904 inline std::size_t hash( T2
const & ) {
return 0; }
905 inline std::size_t hash( T3
const & ) {
return 0; }
906 inline std::size_t hash( T4
const & ) {
return 0; }
907 inline std::size_t hash( T5
const & ) {
return 0; }
908 inline std::size_t hash( T6
const & ) {
return 0; }
909 inline std::size_t hash( T7
const & ) {
return 0; }
910 inline std::size_t hash( T8
const & ) {
return 0; }
911 inline std::size_t hash( T9
const & ) {
return 0; }
912 inline std::size_t hash( T10
const & ) {
return 0; }
913 inline std::size_t hash( T11
const & ) {
return 0; }
914 inline std::size_t hash( T12
const & ) {
return 0; }
915 inline std::size_t hash( T13
const & ) {
return 0; }
916 inline std::size_t hash( T14
const & ) {
return 0; }
917 inline std::size_t hash( T15
const & ) {
return 0; }
920 #endif // variant_CPP11_OR_GREATER 926 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
930 typedef variant_TL16( T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 )
variant_types;
933 static U *
as(
void * data )
935 return reinterpret_cast<U*
>( data );
939 static U
const *
as(
void const * data )
941 return reinterpret_cast<const U*
>( data );
946 return static_cast<type_index_t
>( index );
949 static void destroy( type_index_t index,
void * data )
953 case 0: as<T0>( data )->~
T0();
break;
954 case 1: as<T1>( data )->~
T1();
break;
955 case 2: as<T2>( data )->~
T2();
break;
956 case 3: as<T3>( data )->~
T3();
break;
957 case 4: as<T4>( data )->~
T4();
break;
958 case 5: as<T5>( data )->~
T5();
break;
959 case 6: as<T6>( data )->~
T6();
break;
960 case 7: as<T7>( data )->~
T7();
break;
961 case 8: as<T8>( data )->~
T8();
break;
962 case 9: as<T9>( data )->~
T9();
break;
963 case 10: as<T10>( data )->~
T10();
break;
964 case 11: as<T11>( data )->~
T11();
break;
965 case 12: as<T12>( data )->~
T12();
break;
966 case 13: as<T13>( data )->~
T13();
break;
967 case 14: as<T14>( data )->~
T14();
break;
968 case 15: as<T15>( data )->~
T15();
break;
973 #if variant_CPP11_OR_GREATER 974 template<
class T,
class... Args >
975 static type_index_t construct_t(
void * data, Args&&... args )
977 new( data ) T( std::forward<Args>(args)... );
982 template< std::size_t K,
class... Args >
983 static type_index_t construct_i(
void * data, Args&&... args )
987 construct_t< type >( data, std::forward<Args>(args)... );
989 return to_index_t( K );
992 static type_index_t move_construct( type_index_t
const from_index,
void * from_value,
void * to_value )
994 switch ( from_index )
996 case 0:
new( to_value )
T0(
std::move( *as<T0>( from_value ) ) );
break;
997 case 1:
new( to_value )
T1(
std::move( *as<T1>( from_value ) ) );
break;
998 case 2:
new( to_value )
T2(
std::move( *as<T2>( from_value ) ) );
break;
999 case 3:
new( to_value )
T3(
std::move( *as<T3>( from_value ) ) );
break;
1000 case 4:
new( to_value )
T4(
std::move( *as<T4>( from_value ) ) );
break;
1001 case 5:
new( to_value )
T5(
std::move( *as<T5>( from_value ) ) );
break;
1002 case 6:
new( to_value )
T6(
std::move( *as<T6>( from_value ) ) );
break;
1003 case 7:
new( to_value )
T7(
std::move( *as<T7>( from_value ) ) );
break;
1004 case 8:
new( to_value )
T8(
std::move( *as<T8>( from_value ) ) );
break;
1005 case 9:
new( to_value )
T9(
std::move( *as<T9>( from_value ) ) );
break;
1006 case 10:
new( to_value )
T10(
std::move( *as<T10>( from_value ) ) );
break;
1007 case 11:
new( to_value )
T11(
std::move( *as<T11>( from_value ) ) );
break;
1008 case 12:
new( to_value )
T12(
std::move( *as<T12>( from_value ) ) );
break;
1009 case 13:
new( to_value )
T13(
std::move( *as<T13>( from_value ) ) );
break;
1010 case 14:
new( to_value )
T14(
std::move( *as<T14>( from_value ) ) );
break;
1011 case 15:
new( to_value )
T15(
std::move( *as<T15>( from_value ) ) );
break;
1017 static type_index_t move_assign( type_index_t
const from_index,
void * from_value,
void * to_value )
1019 switch ( from_index )
1021 case 0: *as<T0>( to_value ) =
std::move( *as<T0>( from_value ) );
break;
1022 case 1: *as<T1>( to_value ) =
std::move( *as<T1>( from_value ) );
break;
1023 case 2: *as<T2>( to_value ) =
std::move( *as<T2>( from_value ) );
break;
1024 case 3: *as<T3>( to_value ) =
std::move( *as<T3>( from_value ) );
break;
1025 case 4: *as<T4>( to_value ) =
std::move( *as<T4>( from_value ) );
break;
1026 case 5: *as<T5>( to_value ) =
std::move( *as<T5>( from_value ) );
break;
1027 case 6: *as<T6>( to_value ) =
std::move( *as<T6>( from_value ) );
break;
1028 case 7: *as<T7>( to_value ) =
std::move( *as<T7>( from_value ) );
break;
1029 case 8: *as<T8>( to_value ) =
std::move( *as<T8>( from_value ) );
break;
1030 case 9: *as<T9>( to_value ) =
std::move( *as<T9>( from_value ) );
break;
1031 case 10: *as<T10>( to_value ) =
std::move( *as<T10>( from_value ) );
break;
1032 case 11: *as<T11>( to_value ) =
std::move( *as<T11>( from_value ) );
break;
1033 case 12: *as<T12>( to_value ) =
std::move( *as<T12>( from_value ) );
break;
1034 case 13: *as<T13>( to_value ) =
std::move( *as<T13>( from_value ) );
break;
1035 case 14: *as<T14>( to_value ) =
std::move( *as<T14>( from_value ) );
break;
1036 case 15: *as<T15>( to_value ) =
std::move( *as<T15>( from_value ) );
break;
1043 static type_index_t
copy_construct( type_index_t
const from_index,
const void * from_value,
void * to_value )
1045 switch ( from_index )
1047 case 0:
new( to_value )
T0( *as<T0>( from_value ) );
break;
1048 case 1:
new( to_value )
T1( *as<T1>( from_value ) );
break;
1049 case 2:
new( to_value )
T2( *as<T2>( from_value ) );
break;
1050 case 3:
new( to_value )
T3( *as<T3>( from_value ) );
break;
1051 case 4:
new( to_value )
T4( *as<T4>( from_value ) );
break;
1052 case 5:
new( to_value )
T5( *as<T5>( from_value ) );
break;
1053 case 6:
new( to_value )
T6( *as<T6>( from_value ) );
break;
1054 case 7:
new( to_value )
T7( *as<T7>( from_value ) );
break;
1055 case 8:
new( to_value )
T8( *as<T8>( from_value ) );
break;
1056 case 9:
new( to_value )
T9( *as<T9>( from_value ) );
break;
1057 case 10:
new( to_value )
T10( *as<T10>( from_value ) );
break;
1058 case 11:
new( to_value )
T11( *as<T11>( from_value ) );
break;
1059 case 12:
new( to_value )
T12( *as<T12>( from_value ) );
break;
1060 case 13:
new( to_value )
T13( *as<T13>( from_value ) );
break;
1061 case 14:
new( to_value )
T14( *as<T14>( from_value ) );
break;
1062 case 15:
new( to_value )
T15( *as<T15>( from_value ) );
break;
1068 static type_index_t
copy_assign( type_index_t
const from_index,
const void * from_value,
void * to_value )
1070 switch ( from_index )
1072 case 0: *as<T0>( to_value ) = *as<T0>( from_value );
break;
1073 case 1: *as<T1>( to_value ) = *as<T1>( from_value );
break;
1074 case 2: *as<T2>( to_value ) = *as<T2>( from_value );
break;
1075 case 3: *as<T3>( to_value ) = *as<T3>( from_value );
break;
1076 case 4: *as<T4>( to_value ) = *as<T4>( from_value );
break;
1077 case 5: *as<T5>( to_value ) = *as<T5>( from_value );
break;
1078 case 6: *as<T6>( to_value ) = *as<T6>( from_value );
break;
1079 case 7: *as<T7>( to_value ) = *as<T7>( from_value );
break;
1080 case 8: *as<T8>( to_value ) = *as<T8>( from_value );
break;
1081 case 9: *as<T9>( to_value ) = *as<T9>( from_value );
break;
1082 case 10: *as<T10>( to_value ) = *as<T10>( from_value );
break;
1083 case 11: *as<T11>( to_value ) = *as<T11>( from_value );
break;
1084 case 12: *as<T12>( to_value ) = *as<T12>( from_value );
break;
1085 case 13: *as<T13>( to_value ) = *as<T13>( from_value );
break;
1086 case 14: *as<T14>( to_value ) = *as<T14>( from_value );
break;
1087 case 15: *as<T15>( to_value ) = *as<T15>( from_value );
break;
1100 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1123 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1124 struct variant_size<
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >
1126 enum _ { value =
detail::typelist_size< variant_TL16(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) >::value };
1129 #if variant_CPP14_OR_GREATER 1134 #if ! variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 1135 # define variant_size_V(T) nonstd::variant_size<T>::value 1140 template< std::
size_t K,
class T >
1143 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1144 struct variant_alternative< K,
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >
1146 typedef typename detail::typelist_type_at<variant_TL16(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15), K>::type type;
1149 #if variant_CPP11_OR_GREATER 1150 template< std::
size_t K,
class T >
1154 #if ! variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 1155 # define variant_alternative_T(K,T) typename nonstd::variant_alternative<K,T >::type 1163 #if variant_CPP11_OR_GREATER 1166 static const std::size_t variant_npos =
static_cast<std::size_t
>( -1 );
1169 #if ! variant_CONFIG_NO_EXCEPTIONS 1173 class bad_variant_access :
public std::exception
1176 #if variant_CPP11_OR_GREATER 1179 virtual const char* what()
const throw()
1182 return "bad variant access";
1186 #endif // variant_CONFIG_NO_EXCEPTIONS 1210 typedef detail::helper< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > helper_type;
1211 typedef variant_TL16( T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) variant_types;
1218 variant( T0
const & t0 ) : type_index( 0 ) {
new( ptr() )
T0( t0 ); }
1219 variant( T1
const & t1 ) : type_index( 1 ) {
new( ptr() )
T1( t1 ); }
1220 variant( T2
const & t2 ) : type_index( 2 ) {
new( ptr() )
T2( t2 ); }
1221 variant( T3
const & t3 ) : type_index( 3 ) {
new( ptr() )
T3( t3 ); }
1222 variant( T4
const & t4 ) : type_index( 4 ) {
new( ptr() )
T4( t4 ); }
1223 variant( T5
const & t5 ) : type_index( 5 ) {
new( ptr() )
T5( t5 ); }
1224 variant( T6
const & t6 ) : type_index( 6 ) {
new( ptr() )
T6( t6 ); }
1225 variant( T7
const & t7 ) : type_index( 7 ) {
new( ptr() )
T7( t7 ); }
1226 variant( T8
const & t8 ) : type_index( 8 ) {
new( ptr() )
T8( t8 ); }
1227 variant( T9
const & t9 ) : type_index( 9 ) {
new( ptr() )
T9( t9 ); }
1228 variant( T10
const & t10 ) : type_index( 10 ) {
new( ptr() )
T10( t10 ); }
1229 variant( T11
const & t11 ) : type_index( 11 ) {
new( ptr() )
T11( t11 ); }
1230 variant( T12
const & t12 ) : type_index( 12 ) {
new( ptr() )
T12( t12 ); }
1231 variant( T13
const & t13 ) : type_index( 13 ) {
new( ptr() )
T13( t13 ); }
1232 variant( T14
const & t14 ) : type_index( 14 ) {
new( ptr() )
T14( t14 ); }
1233 variant( T15
const & t15 ) : type_index( 15 ) {
new( ptr() )
T15( t15 ); }
1236 #if variant_CPP11_OR_GREATER 1257 : type_index( other.type_index )
1259 (void) helper_type::copy_construct( other.type_index, other.ptr(), ptr() );
1262 #if variant_CPP11_OR_GREATER 1265 std::is_nothrow_move_constructible<T0>::value &&
1266 std::is_nothrow_move_constructible<T1>::value &&
1267 std::is_nothrow_move_constructible<T2>::value &&
1268 std::is_nothrow_move_constructible<T3>::value &&
1269 std::is_nothrow_move_constructible<T4>::value &&
1270 std::is_nothrow_move_constructible<T5>::value &&
1271 std::is_nothrow_move_constructible<T6>::value &&
1272 std::is_nothrow_move_constructible<T7>::value &&
1273 std::is_nothrow_move_constructible<T8>::value &&
1274 std::is_nothrow_move_constructible<T9>::value &&
1275 std::is_nothrow_move_constructible<T10>::value &&
1276 std::is_nothrow_move_constructible<T11>::value &&
1277 std::is_nothrow_move_constructible<T12>::value &&
1278 std::is_nothrow_move_constructible<T13>::value &&
1279 std::is_nothrow_move_constructible<T14>::value &&
1280 std::is_nothrow_move_constructible<T15>::value)
1281 : type_index( other.type_index )
1283 (void) helper_type::move_construct( other.type_index, other.ptr(), ptr() );
1286 template< std::
size_t K >
1289 template<
class T,
class... Args
1290 variant_REQUIRES_T( std::is_constructible< T, Args...>::value )
1294 type_index = variant_npos_internal();
1295 type_index = helper_type::template construct_t<T>( ptr(), std::forward<Args>(args)... );
1298 template<
class T,
class U,
class... Args
1299 variant_REQUIRES_T( std::is_constructible< T, std::initializer_list<U>&, Args...>::value )
1303 type_index = variant_npos_internal();
1304 type_index = helper_type::template construct_t<T>( ptr(), il, std::forward<Args>(args)... );
1307 template< std::size_t K,
class... Args
1308 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, Args...>::value )
1312 type_index = variant_npos_internal();
1313 type_index = helper_type::template construct_i<K>( ptr(), std::forward<Args>(args)... );
1316 template<
size_t K,
class U,
class... Args
1317 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, std::initializer_list<U>&, Args...>::value )
1321 type_index = variant_npos_internal();
1322 type_index = helper_type::template construct_i<K>( ptr(), il, std::forward<Args>(args)... );
1325 #endif // variant_CPP11_OR_GREATER 1331 if ( ! valueless_by_exception() )
1333 helper_type::destroy( type_index, ptr() );
1341 return copy_assign( other );
1344 #if variant_CPP11_OR_GREATER 1347 std::is_nothrow_move_assignable<T0>::value &&
1348 std::is_nothrow_move_assignable<T1>::value &&
1349 std::is_nothrow_move_assignable<T2>::value &&
1350 std::is_nothrow_move_assignable<T3>::value &&
1351 std::is_nothrow_move_assignable<T4>::value &&
1352 std::is_nothrow_move_assignable<T5>::value &&
1353 std::is_nothrow_move_assignable<T6>::value &&
1354 std::is_nothrow_move_assignable<T7>::value &&
1355 std::is_nothrow_move_assignable<T8>::value &&
1356 std::is_nothrow_move_assignable<T9>::value &&
1357 std::is_nothrow_move_assignable<T10>::value &&
1358 std::is_nothrow_move_assignable<T11>::value &&
1359 std::is_nothrow_move_assignable<T12>::value &&
1360 std::is_nothrow_move_assignable<T13>::value &&
1361 std::is_nothrow_move_assignable<T14>::value &&
1362 std::is_nothrow_move_assignable<T15>::value)
1364 return move_assign(
std::move( other ) );
1367 variant & operator=( T0 && t0 ) {
return assign_value<0>(
std::move( t0 ) ); }
1368 variant & operator=( T1 && t1 ) {
return assign_value<1>(
std::move( t1 ) ); }
1369 variant & operator=( T2 && t2 ) {
return assign_value<2>(
std::move( t2 ) ); }
1370 variant & operator=( T3 && t3 ) {
return assign_value<3>(
std::move( t3 ) ); }
1371 variant & operator=( T4 && t4 ) {
return assign_value<4>(
std::move( t4 ) ); }
1372 variant & operator=( T5 && t5 ) {
return assign_value<5>(
std::move( t5 ) ); }
1373 variant & operator=( T6 && t6 ) {
return assign_value<6>(
std::move( t6 ) ); }
1374 variant & operator=( T7 && t7 ) {
return assign_value<7>(
std::move( t7 ) ); }
1375 variant & operator=( T8 && t8 ) {
return assign_value<8>(
std::move( t8 ) ); }
1376 variant & operator=( T9 && t9 ) {
return assign_value<9>(
std::move( t9 ) ); }
1377 variant & operator=( T10 && t10 ) {
return assign_value<10>(
std::move( t10 ) ); }
1378 variant & operator=( T11 && t11 ) {
return assign_value<11>(
std::move( t11 ) ); }
1379 variant & operator=( T12 && t12 ) {
return assign_value<12>(
std::move( t12 ) ); }
1380 variant & operator=( T13 && t13 ) {
return assign_value<13>(
std::move( t13 ) ); }
1381 variant & operator=( T14 && t14 ) {
return assign_value<14>(
std::move( t14 ) ); }
1382 variant & operator=( T15 && t15 ) {
return assign_value<15>(
std::move( t15 ) ); }
1407 return variant_npos_internal() == type_index ?
variant_npos :
static_cast<std::size_t
>( type_index );
1412 #if variant_CPP11_OR_GREATER 1413 template<
class T,
class... Args
1414 variant_REQUIRES_T( std::is_constructible< T, Args...>::value )
1416 T& emplace( Args&&... args )
1418 helper_type::destroy( type_index, ptr() );
1419 type_index = variant_npos_internal();
1420 type_index = helper_type::template construct_t<T>( ptr(), std::forward<Args>(args)... );
1425 template<
class T,
class U,
class... Args
1426 variant_REQUIRES_T( std::is_constructible< T, std::initializer_list<U>&, Args...>::value )
1428 T& emplace( std::initializer_list<U> il, Args&&... args )
1430 helper_type::destroy( type_index, ptr() );
1431 type_index = variant_npos_internal();
1432 type_index = helper_type::template construct_t<T>( ptr(), il, std::forward<Args>(args)... );
1437 template<
size_t K,
class... Args
1438 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, Args...>::value )
1440 variant_alternative_t<K, variant> & emplace( Args&&... args )
1442 return this->
template emplace< type_at_t<K> >( std::forward<Args>(args)... );
1445 template<
size_t K,
class U,
class... Args
1446 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, std::initializer_list<U>&, Args...>::value )
1448 variant_alternative_t<K, variant> & emplace( std::initializer_list<U> il, Args&&... args )
1450 return this->
template emplace< type_at_t<K> >( il, std::forward<Args>(args)... );
1453 #endif // variant_CPP11_OR_GREATER 1459 return type_index == variant_npos_internal();
1465 #if variant_CPP11_OR_GREATER 1467 std::is_nothrow_move_constructible<T0>::value && std17::is_nothrow_swappable<T0>::value &&
1468 std::is_nothrow_move_constructible<T1>::value && std17::is_nothrow_swappable<T1>::value &&
1469 std::is_nothrow_move_constructible<T2>::value && std17::is_nothrow_swappable<T2>::value &&
1470 std::is_nothrow_move_constructible<T3>::value && std17::is_nothrow_swappable<T3>::value &&
1471 std::is_nothrow_move_constructible<T4>::value && std17::is_nothrow_swappable<T4>::value &&
1472 std::is_nothrow_move_constructible<T5>::value && std17::is_nothrow_swappable<T5>::value &&
1473 std::is_nothrow_move_constructible<T6>::value && std17::is_nothrow_swappable<T6>::value &&
1474 std::is_nothrow_move_constructible<T7>::value && std17::is_nothrow_swappable<T7>::value &&
1475 std::is_nothrow_move_constructible<T8>::value && std17::is_nothrow_swappable<T8>::value &&
1476 std::is_nothrow_move_constructible<T9>::value && std17::is_nothrow_swappable<T9>::value &&
1477 std::is_nothrow_move_constructible<T10>::value && std17::is_nothrow_swappable<T10>::value &&
1478 std::is_nothrow_move_constructible<T11>::value && std17::is_nothrow_swappable<T11>::value &&
1479 std::is_nothrow_move_constructible<T12>::value && std17::is_nothrow_swappable<T12>::value &&
1480 std::is_nothrow_move_constructible<T13>::value && std17::is_nothrow_swappable<T13>::value &&
1481 std::is_nothrow_move_constructible<T14>::value && std17::is_nothrow_swappable<T14>::value &&
1482 std::is_nothrow_move_constructible<T15>::value && std17::is_nothrow_swappable<T15>::value
1491 else if ( type_index == other.type_index )
1493 this->swap_value( type_index, other );
1497 #if variant_CPP11_OR_GREATER 1522 const std::size_t i = index_of<T>();
1524 #if variant_CONFIG_NO_EXCEPTIONS 1525 assert( i == index() );
1529 throw bad_variant_access();
1536 T
const &
get()
const 1538 const std::size_t i = index_of<T>();
1540 #if variant_CONFIG_NO_EXCEPTIONS 1541 assert( i == index() );
1545 throw bad_variant_access();
1548 return *as<const T>();
1551 template< std::
size_t K >
1555 return this->
template get< typename detail::typelist_type_at< variant_types, K >::type >();
1558 template< std::
size_t K >
1562 return this->
template get< typename detail::typelist_type_at< variant_types, K >::type >();
1581 return reinterpret_cast<U*
>( ptr() );
1585 U
const * as()
const 1587 return reinterpret_cast<U
const *
>( ptr() );
1593 return static_cast<std::size_t
>( index );
1598 return static_cast<type_index_t
>( -1 );
1609 helper_type::destroy( type_index, ptr() );
1610 type_index = variant_npos_internal();
1612 else if ( index() == other.
index() )
1614 type_index = helper_type::copy_assign( other.type_index, other.ptr(), ptr() );
1618 helper_type::destroy( type_index, ptr() );
1619 type_index = variant_npos_internal();
1620 type_index = helper_type::copy_construct( other.type_index, other.ptr(), ptr() );
1625 #if variant_CPP11_OR_GREATER 1635 helper_type::destroy( type_index, ptr() );
1636 type_index = variant_npos_internal();
1638 else if ( index() == other.
index() )
1640 type_index = helper_type::move_assign( other.type_index, other.ptr(), ptr() );
1644 helper_type::destroy( type_index, ptr() );
1645 type_index = variant_npos_internal();
1646 type_index = helper_type::move_construct( other.type_index, other.ptr(), ptr() );
1651 template< std::
size_t K,
class T >
1652 variant & assign_value( T && value )
1656 *as<T>() = std::forward<T>( value );
1660 helper_type::destroy( type_index, ptr() );
1661 type_index = variant_npos_internal();
1662 new( ptr() ) T( std::forward<T>( value ) );
1668 #endif // variant_CPP11_OR_GREATER 1670 template< std::
size_t K,
class T >
1671 variant & assign_value( T
const & value )
1679 helper_type::destroy( type_index, ptr() );
1680 type_index = variant_npos_internal();
1681 new( ptr() ) T( value );
1687 void swap_value( type_index_t index,
variant & other )
1692 case 0:
swap( this->get<0>(), other.
get<0>() );
break;
1693 case 1:
swap( this->get<1>(), other.
get<1>() );
break;
1694 case 2:
swap( this->get<2>(), other.
get<2>() );
break;
1695 case 3:
swap( this->get<3>(), other.
get<3>() );
break;
1696 case 4:
swap( this->get<4>(), other.
get<4>() );
break;
1697 case 5:
swap( this->get<5>(), other.
get<5>() );
break;
1698 case 6:
swap( this->get<6>(), other.
get<6>() );
break;
1699 case 7:
swap( this->get<7>(), other.
get<7>() );
break;
1700 case 8:
swap( this->get<8>(), other.
get<8>() );
break;
1701 case 9:
swap( this->get<9>(), other.
get<9>() );
break;
1702 case 10:
swap( this->get<10>(), other.
get<10>() );
break;
1703 case 11:
swap( this->get<11>(), other.
get<11>() );
break;
1704 case 12:
swap( this->get<12>(), other.
get<12>() );
break;
1705 case 13:
swap( this->get<13>(), other.
get<13>() );
break;
1706 case 14:
swap( this->get<14>(), other.
get<14>() );
break;
1707 case 15:
swap( this->get<15>(), other.
get<15>() );
break;
1715 #if variant_CPP11_OR_GREATER 1717 enum { data_align = detail::typelist_max_alignof< variant_types >::value };
1719 using aligned_storage_t =
typename std::aligned_storage< data_size, data_align >::type;
1720 aligned_storage_t data;
1722 #elif variant_CONFIG_MAX_ALIGN_HACK 1724 typedef union {
unsigned char data[ data_size ]; } aligned_storage_t;
1726 detail::max_align_t hack;
1727 aligned_storage_t data;
1734 typedef union { align_as_type data[ 1 + ( data_size - 1 ) /
sizeof(align_as_type) ]; } aligned_storage_t;
1735 aligned_storage_t data;
1739 #endif // variant_CONFIG_MAX_ALIGN_HACK 1741 type_index_t type_index;
1746 template<
class T,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1747 inline bool holds_alternative(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v )
variant_noexcept 1749 return v.index() ==
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::template index_of<T>();
1752 template<
class R,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1753 inline R &
get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> & v,
nonstd_lite_in_place_type_t(R) =
nonstd_lite_in_place_type(R) )
1755 return v.template get<R>();
1758 template<
class R,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1759 inline R
const &
get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
nonstd_lite_in_place_type_t(R) =
nonstd_lite_in_place_type(R) )
1761 return v.template get<R>();
1764 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1765 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type &
1766 get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> & v,
nonstd_lite_in_place_index_t(K) =
nonstd_lite_in_place_index(K) )
1768 #if variant_CONFIG_NO_EXCEPTIONS 1769 assert( K == v.
index() );
1771 if ( K != v.
index() )
1773 throw bad_variant_access();
1776 return v.template get<K>();
1779 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1780 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type
const &
1781 get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
nonstd_lite_in_place_index_t(K) =
nonstd_lite_in_place_index(K) )
1783 #if variant_CONFIG_NO_EXCEPTIONS 1784 assert( K == v.
index() );
1786 if ( K != v.
index() )
1788 throw bad_variant_access();
1791 return v.template get<K>();
1794 #if variant_CPP11_OR_GREATER 1796 template<
class R,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1797 inline R &&
get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> && v,
nonstd_lite_in_place_type_t(R) =
nonstd_lite_in_place_type(R) )
1802 template<
class R,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1803 inline R
const &&
get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const && v,
nonstd_lite_in_place_type_t(R) =
nonstd_lite_in_place_type(R) )
1808 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1809 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type &&
1810 get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> && v,
nonstd_lite_in_place_index_t(K) =
nonstd_lite_in_place_index(K) )
1812 #if variant_CONFIG_NO_EXCEPTIONS 1813 assert( K == v.index() );
1815 if ( K != v.index() )
1817 throw bad_variant_access();
1823 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1824 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type
const &&
1825 get(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const && v,
nonstd_lite_in_place_index_t(K) =
nonstd_lite_in_place_index(K) )
1827 #if variant_CONFIG_NO_EXCEPTIONS 1828 assert( K == v.index() );
1830 if ( K != v.index() )
1832 throw bad_variant_access();
1838 #endif // variant_CPP11_OR_GREATER 1840 template<
class T,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1842 get_if(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> * pv,
nonstd_lite_in_place_type_t(T) =
nonstd_lite_in_place_type(T) )
1844 return ( pv->
index() ==
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::template index_of<T>() ) ? &get<T>( *pv ) :
variant_nullptr;
1847 template<
class T,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1849 get_if(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const * pv,
nonstd_lite_in_place_type_t(T) =
nonstd_lite_in_place_type(T))
1851 return ( pv->
index() ==
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::template index_of<T>() ) ? &get<T>( *pv ) :
variant_nullptr;
1854 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1855 inline typename std11::add_pointer< typename variant_alternative<K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type >::type
1856 get_if(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> * pv,
nonstd_lite_in_place_index_t(K) =
nonstd_lite_in_place_index(K) )
1861 template< std::
size_t K,
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
1862 inline typename std11::add_pointer< const typename variant_alternative<K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type >::type
1863 get_if(
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const * pv,
nonstd_lite_in_place_index_t(K) =
nonstd_lite_in_place_index(K) )
1870 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15
1871 #if variant_CPP11_OR_GREATER 1873 std::is_move_constructible<T0>::value && std17::is_swappable<T0>::value &&
1874 std::is_move_constructible<T1>::value && std17::is_swappable<T1>::value &&
1875 std::is_move_constructible<T2>::value && std17::is_swappable<T2>::value &&
1876 std::is_move_constructible<T3>::value && std17::is_swappable<T3>::value &&
1877 std::is_move_constructible<T4>::value && std17::is_swappable<T4>::value &&
1878 std::is_move_constructible<T5>::value && std17::is_swappable<T5>::value &&
1879 std::is_move_constructible<T6>::value && std17::is_swappable<T6>::value &&
1880 std::is_move_constructible<T7>::value && std17::is_swappable<T7>::value &&
1881 std::is_move_constructible<T8>::value && std17::is_swappable<T8>::value &&
1882 std::is_move_constructible<T9>::value && std17::is_swappable<T9>::value &&
1883 std::is_move_constructible<T10>::value && std17::is_swappable<T10>::value &&
1884 std::is_move_constructible<T11>::value && std17::is_swappable<T11>::value &&
1885 std::is_move_constructible<T12>::value && std17::is_swappable<T12>::value &&
1886 std::is_move_constructible<T13>::value && std17::is_swappable<T13>::value &&
1887 std::is_move_constructible<T14>::value && std17::is_swappable<T14>::value &&
1888 std::is_move_constructible<T15>::value && std17::is_swappable<T15>::value
1893 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> & a,
1894 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> & b )
1895 #if variant_CPP11_OR_GREATER 1896 noexcept( noexcept( a.
swap( b ) ) )
1909 template<
typename R,
typename VT >
1912 template<
typename Visitor,
typename T >
1913 static R
apply(Visitor
const& v, T
const& arg)
1919 template<
typename R,
typename VT >
1922 template<
typename Visitor,
typename T >
1929 template<
typename R>
1932 template<
typename R,
typename Visitor,
typename V1 >
1935 #if variant_CPP11_OR_GREATER 1936 template<
size_t NumVars,
typename R,
typename Visitor,
typename ... T >
1938 template<
size_t NumVars,
typename R,
typename Visitor,
typename T1,
typename T2 = S0,
typename T3 = S0,
typename T4 = S0,
typename T5 = S0 >
1942 template<
typename R,
typename Visitor,
typename T2 >
1955 template<
typename T>
1958 return visitor(val1, val2);
1962 template<
typename R,
typename Visitor,
typename T2,
typename T3 >
1977 template<
typename T>
1980 return visitor(val1, val2, val3);
1984 template<
typename R,
typename Visitor,
typename T2,
typename T3,
typename T4 >
2001 template<
typename T>
2004 return visitor(val1, val2, val3, val4);
2008 template<
typename R,
typename Visitor,
typename T2,
typename T3,
typename T4,
typename T5 >
2027 template<
typename T>
2030 return visitor(val1, val2, val3, val4, val5);
2036 template<
typename R,
typename Visitor,
typename V2>
2049 template<
typename T1 >
2056 template<
typename T1,
typename T2 >
2063 template<
typename T1,
typename T2,
typename T3 >
2064 R
operator()(T1
const& val1, T2
const& val2, T3
const& val3)
const 2070 template<
typename T1,
typename T2,
typename T3,
typename T4 >
2071 R
operator()(T1
const& val1, T2
const& val2, T3
const& val3, T4
const& val4)
const 2077 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5 >
2078 R
operator()(T1
const& val1, T2
const& val2, T3
const& val3, T4
const& val4, T5
const& val5)
const 2087 template<
typename R>
2090 template<
typename Visitor,
typename V1>
2091 static R
apply(
const Visitor& v,
const V1& arg)
2093 switch( arg.index() )
2095 case 0:
return apply_visitor<0>(v, arg);
2096 case 1:
return apply_visitor<1>(v, arg);
2097 case 2:
return apply_visitor<2>(v, arg);
2098 case 3:
return apply_visitor<3>(v, arg);
2099 case 4:
return apply_visitor<4>(v, arg);
2100 case 5:
return apply_visitor<5>(v, arg);
2101 case 6:
return apply_visitor<6>(v, arg);
2102 case 7:
return apply_visitor<7>(v, arg);
2103 case 8:
return apply_visitor<8>(v, arg);
2104 case 9:
return apply_visitor<9>(v, arg);
2105 case 10:
return apply_visitor<10>(v, arg);
2106 case 11:
return apply_visitor<11>(v, arg);
2107 case 12:
return apply_visitor<12>(v, arg);
2108 case 13:
return apply_visitor<13>(v, arg);
2109 case 14:
return apply_visitor<14>(v, arg);
2110 case 15:
return apply_visitor<15>(v, arg);
2112 default:
return R();
2116 template<
size_t Idx,
typename Visitor,
typename V1>
2120 #if variant_CPP11_OR_GREATER 2128 #if variant_CPP11_OR_GREATER 2129 template<
typename Visitor,
typename V1,
typename V2,
typename ... V>
2130 static R apply(
const Visitor& v,
const V1& arg1,
const V2& arg2,
const V ... args)
2133 Unwrapper unwrapper(v, arg1);
2134 return apply(unwrapper, arg2, args ...);
2138 template<
typename Visitor,
typename V1,
typename V2 >
2139 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2)
2142 Unwrapper unwrapper(v, arg1);
2143 return apply(unwrapper, arg2);
2146 template<
typename Visitor,
typename V1,
typename V2,
typename V3 >
2147 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3)
2150 Unwrapper unwrapper(v, arg1);
2151 return apply(unwrapper, arg2, arg3);
2154 template<
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4 >
2155 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4)
2158 Unwrapper unwrapper(v, arg1);
2159 return apply(unwrapper, arg2, arg3, arg4);
2162 template<
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4,
typename V5 >
2163 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4, V5
const& arg5)
2166 Unwrapper unwrapper(v, arg1);
2167 return apply(unwrapper, arg2, arg3, arg4, arg5);
2173 #if variant_CPP11_OR_GREATER 2174 template<
size_t NumVars,
typename Visitor,
typename ... V >
2177 typedef decltype(std::declval<Visitor>()(get<0>(static_cast<const V&>(std::declval<V>()))...)) result_type;
2183 #if variant_CPP11_OR_GREATER 2185 template<
typename Visitor,
typename ... V >
2186 inline auto visit(Visitor
const& v, V
const& ... vars) ->
typename detail::VisitorImpl<
sizeof ... (V), Visitor, V... > ::result_type
2188 typedef detail::VisitorImpl<sizeof ... (V), Visitor, V... > impl_type;
2189 return impl_type::applicator_type::apply(v, vars...);
2193 template<
typename R,
typename Visitor,
typename V1 >
2194 inline R
visit(
const Visitor& v, V1
const& arg1)
2199 template<
typename R,
typename Visitor,
typename V1,
typename V2 >
2200 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2)
2205 template<
typename R,
typename Visitor,
typename V1,
typename V2,
typename V3 >
2206 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3)
2211 template<
typename R,
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4 >
2212 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4)
2217 template<
typename R,
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4,
typename V5 >
2218 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4, V5
const& arg5)
2229 template<
class Variant >
2232 static inline bool equal( Variant
const & v, Variant
const & w )
2236 case 0:
return get<0>( v ) == get<0>( w );
2237 case 1:
return get<1>( v ) == get<1>( w );
2238 case 2:
return get<2>( v ) == get<2>( w );
2239 case 3:
return get<3>( v ) == get<3>( w );
2240 case 4:
return get<4>( v ) == get<4>( w );
2241 case 5:
return get<5>( v ) == get<5>( w );
2242 case 6:
return get<6>( v ) == get<6>( w );
2243 case 7:
return get<7>( v ) == get<7>( w );
2244 case 8:
return get<8>( v ) == get<8>( w );
2245 case 9:
return get<9>( v ) == get<9>( w );
2246 case 10:
return get<10>( v ) == get<10>( w );
2247 case 11:
return get<11>( v ) == get<11>( w );
2248 case 12:
return get<12>( v ) == get<12>( w );
2249 case 13:
return get<13>( v ) == get<13>( w );
2250 case 14:
return get<14>( v ) == get<14>( w );
2251 case 15:
return get<15>( v ) == get<15>( w );
2253 default:
return false;
2257 static inline bool less_than( Variant
const & v, Variant
const & w )
2261 case 0:
return get<0>( v ) < get<0>( w );
2262 case 1:
return get<1>( v ) < get<1>( w );
2263 case 2:
return get<2>( v ) < get<2>( w );
2264 case 3:
return get<3>( v ) < get<3>( w );
2265 case 4:
return get<4>( v ) < get<4>( w );
2266 case 5:
return get<5>( v ) < get<5>( w );
2267 case 6:
return get<6>( v ) < get<6>( w );
2268 case 7:
return get<7>( v ) < get<7>( w );
2269 case 8:
return get<8>( v ) < get<8>( w );
2270 case 9:
return get<9>( v ) < get<9>( w );
2271 case 10:
return get<10>( v ) < get<10>( w );
2272 case 11:
return get<11>( v ) < get<11>( w );
2273 case 12:
return get<12>( v ) < get<12>( w );
2274 case 13:
return get<13>( v ) < get<13>( w );
2275 case 14:
return get<14>( v ) < get<14>( w );
2276 case 15:
return get<15>( v ) < get<15>( w );
2278 default:
return false;
2285 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2287 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2288 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2292 else return detail::Comparator< variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::equal( v, w );
2295 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2297 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2298 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2300 return ! ( v == w );
2303 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2305 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2306 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2310 else if ( v.
index() < w.
index() )
return true;
2311 else if ( v.
index() > w.
index() )
return false;
2312 else return detail::Comparator< variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::less_than( v, w );
2315 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2317 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2318 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2323 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2325 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2326 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2331 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2333 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2334 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2341 using namespace variants;
2345 #if variant_CPP11_OR_GREATER 2360 template<
class T0,
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8,
class T9,
class T10,
class T11,
class T12,
class T13,
class T14,
class T15 >
2361 struct hash< nonstd::
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >
2363 std::size_t operator()(
nonstd::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v )
const variant_noexcept 2369 case 0:
return nvd::hash( 0 ) ^ nvd::hash( get<0>( v ) );
2370 case 1:
return nvd::hash( 1 ) ^ nvd::hash( get<1>( v ) );
2371 case 2:
return nvd::hash( 2 ) ^ nvd::hash( get<2>( v ) );
2372 case 3:
return nvd::hash( 3 ) ^ nvd::hash( get<3>( v ) );
2373 case 4:
return nvd::hash( 4 ) ^ nvd::hash( get<4>( v ) );
2374 case 5:
return nvd::hash( 5 ) ^ nvd::hash( get<5>( v ) );
2375 case 6:
return nvd::hash( 6 ) ^ nvd::hash( get<6>( v ) );
2376 case 7:
return nvd::hash( 7 ) ^ nvd::hash( get<7>( v ) );
2377 case 8:
return nvd::hash( 8 ) ^ nvd::hash( get<8>( v ) );
2378 case 9:
return nvd::hash( 9 ) ^ nvd::hash( get<9>( v ) );
2379 case 10:
return nvd::hash( 10 ) ^ nvd::hash( get<10>( v ) );
2380 case 11:
return nvd::hash( 11 ) ^ nvd::hash( get<11>( v ) );
2381 case 12:
return nvd::hash( 12 ) ^ nvd::hash( get<12>( v ) );
2382 case 13:
return nvd::hash( 13 ) ^ nvd::hash( get<13>( v ) );
2383 case 14:
return nvd::hash( 14 ) ^ nvd::hash( get<14>( v ) );
2384 case 15:
return nvd::hash( 15 ) ^ nvd::hash( get<15>( v ) );
2386 default:
return false;
2393 #endif // variant_CPP11_OR_GREATER 2395 #if variant_BETWEEN( variant_COMPILER_MSVC_VER, 1300, 1900 ) 2396 # pragma warning( pop ) 2399 #endif // variant_USES_STD_VARIANT 2401 #endif // NONSTD_VARIANT_LITE_HPP
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_)
variant & operator=(T2 const &t2)
static R apply(Visitor const &v, T const &arg)
std::size_t index() const
static R apply(Visitor const &, T)
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3, V4 const &arg4, V5 const &arg5)
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3)
variant_alternative< K, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > >::type const & get(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, nonstd::in_place_t(&)(nonstd::detail::in_place_index_tag< K >)=nonstd::in_place_index< K >)
static bool equal(Variant const &v, Variant const &w)
void swap(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > &a, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > &b)
static R apply_visitor(const Visitor &v, const V1 &arg)
std::ostream & operator<<(std::ostream &os, const Data &data)
variant(variant const &other)
detail::typelist< T0, detail::typelist< T1, detail::typelist< T2, detail::typelist< T3, detail::typelist< T4, detail::typelist< T5, detail::typelist< T6, detail::typelist< T7, detail::typelist< T8, detail::typelist< T9, detail::typelist< T10, detail::typelist< T11, detail::typelist< T12, detail::typelist< T13, detail::typelist< T14, detail::typelist< T15, detail::nulltype > > > > > > > > > > > > > > > > variant_types
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_)
R operator()(T1 const &val1, T2 const &val2, T3 const &val3) const
VisitorUnwrapper(const Visitor &visitor_, const V2 &r_)
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2)
bool operator>=(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &w)
#define variant_TL16(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)
bool valueless_by_exception() const
nonstd::variants::variant_alternative< K, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > >::type detail::typelist_type_at< detail::typelist< T0, detail::typelist< T1, detail::typelist< T2, detail::typelist< T3, detail::typelist< T4, detail::typelist< T5, detail::typelist< T6, detail::typelist< T7, detail::typelist< T8, detail::typelist< T9, detail::typelist< T10, detail::typelist< T11, detail::typelist< T12, detail::typelist< T13, detail::typelist< T14, detail::typelist< T15, detail::nulltype > > > > > > > > > > > > > > > >, K >::type type
variant & operator=(variant const &other)
#define nonstd_lite_in_place_index(K)
variant & operator=(T7 const &t7)
static const std::size_t variant_npos
R operator()(T1 const &val1, T2 const &val2, T3 const &val3, T4 const &val4, T5 const &val5) const
bool operator<(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &w)
R operator()(const T &val1) const
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3, V4 const &arg4)
in_place_t in_place_index(detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
void swap(variant &other)
TX< T > operator||(U const &) const
std11::add_pointer< const typename variant_alternative< K, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > >::type >::type get_if(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const *pv, nonstd::in_place_t(&)(nonstd::detail::in_place_index_tag< K >)=nonstd::in_place_index< K >)
remove_volatile< typename remove_const< T >::type >::type type
remove_reference< T >::type * type
#define nonstd_lite_in_place_type(T)
static type_index_t copy_assign(type_index_t const from_index, const void *from_value, void *to_value)
bool operator==(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &w)
nonstd::variants::variant_size< variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > >::_ _
R operator()(T1 const &val1, T2 const &val2) const
#define variant_constexpr
bool operator>(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &w)
#define variant_CONFIG_ALIGN_AS_FALLBACK
variant & operator=(T11 const &t11)
static type_index_t copy_construct(type_index_t const from_index, const void *from_value, void *to_value)
bool operator!=(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &w)
variant & operator=(T3 const &t3)
std11::conditional< N==sizeof(typename List::head), typename List::head, typename type_of_size< typename List::tail, N >::type >::type type
TX< T > operator>>(U const &) const
variant & operator=(T9 const &t9)
static U const * as(void const *data)
variant & operator=(T6 const &t6)
#define variant_ALIGN_AS(to_align)
#define nonstd_lite_in_place_index_t(K)
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_, T4 const &val4_, T5 const &val5_)
#define variant_ALIGN_TYPE(type)
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_, T4 const &val4_)
bool holds_alternative(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v)
variant & operator=(T8 const &t8)
variant & operator=(T0 const &t0)
static void destroy(type_index_t index, void *data)
static type_index_t to_index_t(std::size_t index)
static U * as(void *data)
std11::conditional<(sizeof(Head) > tail_value), Head, tail_type >::type type
variant & operator=(T5 const &t5)
typelist< char, typelist< struct_t< char >, typelist< short, typelist< struct_t< short >, typelist< int, typelist< struct_t< int >, typelist< long, typelist< struct_t< long >, typelist< float, typelist< struct_t< float >, typelist< double, typelist< struct_t< double >, typelist< long double, typelist< struct_t< long double >, typelist< char *, typelist< struct_t< char *>, typelist< short *, typelist< struct_t< short *>, typelist< int *, typelist< struct_t< int *>, typelist< long *, typelist< struct_t< long *>, typelist< float *, typelist< struct_t< float *>, typelist< double *, typelist< struct_t< double *>, typelist< long double *, typelist< struct_t< long double *>, typelist< Unknown(*)(Unknown), typelist< struct_t< Unknown(*)(Unknown) >, typelist< Unknown *Unknown::*, typelist< struct_t< Unknown *Unknown::*>, typelist< Unknown(Unknown::*)(Unknown), typelist< struct_t< Unknown(Unknown::*)(Unknown) >, nulltype > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > alignment_types
in_place_t in_place_type(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
R operator()(T1 const &val1) const
R operator()(T1 const &val1, T2 const &val2, T3 const &val3, T4 const &val4) const
R operator()(const T &val1) const
variant & operator=(T14 const &t14)
R operator()(const T &val1) const
variant & operator=(T13 const &t13)
variant & operator=(T1 const &t1)
variant & operator=(T12 const &t12)
R operator()(const T &val1) const
typelist_type_at< Tail, i - 1 >::type type
static std::size_t index_of()
static R apply(const Visitor &v, const V1 &arg)
variant & operator=(T15 const &t15)
bool operator<=(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v, variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &w)
bool operator==(T const &) const
R visit(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3, V4 const &arg4, V5 const &arg5)
variant & operator=(T4 const &t4)
in_place_t in_place(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
static bool less_than(Variant const &v, Variant const &w)
#define nonstd_lite_in_place_type_t(T)
variant & operator=(T10 const &t10)