10 #ifndef NONSTD_VARIANT_LITE_HPP 11 #define NONSTD_VARIANT_LITE_HPP 13 #define variant_lite_MAJOR 2 14 #define variant_lite_MINOR 0 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 31 # if __has_include(<nonstd/variant.tweak.hpp>) 32 # include <nonstd/variant.tweak.hpp> 34 #define variant_HAVE_TWEAK_HEADER 1 36 #define variant_HAVE_TWEAK_HEADER 0 42 #ifndef variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 43 # define variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 0 46 #ifndef variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 47 # define variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 0 52 #ifndef variant_CONFIG_NO_EXCEPTIONS 56 # if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || (_HAS_EXCEPTIONS) 57 # define variant_CONFIG_NO_EXCEPTIONS 0 59 # define variant_CONFIG_NO_EXCEPTIONS 1 66 #ifndef variant_CPLUSPLUS 67 # if defined(_MSVC_LANG ) && !defined(__clang__) 68 # define variant_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG ) 70 # define variant_CPLUSPLUS __cplusplus 74 #define variant_CPP98_OR_GREATER ( variant_CPLUSPLUS >= 199711L ) 75 #define variant_CPP11_OR_GREATER ( variant_CPLUSPLUS >= 201103L ) 76 #define variant_CPP11_OR_GREATER_ ( variant_CPLUSPLUS >= 201103L ) 77 #define variant_CPP14_OR_GREATER ( variant_CPLUSPLUS >= 201402L ) 78 #define variant_CPP17_OR_GREATER ( variant_CPLUSPLUS >= 201703L ) 79 #define variant_CPP20_OR_GREATER ( variant_CPLUSPLUS >= 202000L ) 83 #if variant_CPP17_OR_GREATER && defined(__has_include ) 84 # if __has_include( <variant> ) 85 # define variant_HAVE_STD_VARIANT 1 87 # define variant_HAVE_STD_VARIANT 0 90 # define variant_HAVE_STD_VARIANT 0 93 #if !defined( variant_CONFIG_SELECT_VARIANT ) 94 # define variant_CONFIG_SELECT_VARIANT ( variant_HAVE_STD_VARIANT ? variant_VARIANT_STD : variant_VARIANT_NONSTD ) 97 #define variant_USES_STD_VARIANT ( (variant_CONFIG_SELECT_VARIANT == variant_VARIANT_STD) || ((variant_CONFIG_SELECT_VARIANT == variant_VARIANT_DEFAULT) && variant_HAVE_STD_VARIANT) ) 103 #ifndef nonstd_lite_HAVE_IN_PLACE_TYPES 104 #define nonstd_lite_HAVE_IN_PLACE_TYPES 1 108 #if variant_CPP17_OR_GREATER 117 using std::in_place_t;
118 using std::in_place_type_t;
119 using std::in_place_index_t;
121 #define nonstd_lite_in_place_t( T) std::in_place_t 122 #define nonstd_lite_in_place_type_t( T) std::in_place_type_t<T> 123 #define nonstd_lite_in_place_index_t(K) std::in_place_index_t<K> 125 #define nonstd_lite_in_place( T) std::in_place_t{} 126 #define nonstd_lite_in_place_type( T) std::in_place_type_t<T>{} 127 #define nonstd_lite_in_place_index(K) std::in_place_index_t<K>{} 131 #else // variant_CPP17_OR_GREATER 139 struct in_place_type_tag {};
141 template< std::
size_t K >
142 struct in_place_index_tag {};
146 struct in_place_t {};
149 inline in_place_t
in_place( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
154 template< std::
size_t K >
155 inline in_place_t
in_place( detail::in_place_index_tag<K> = detail::in_place_index_tag<K>() )
161 inline in_place_t
in_place_type( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
166 template< std::
size_t K >
167 inline in_place_t
in_place_index( detail::in_place_index_tag<K> = detail::in_place_index_tag<K>() )
174 #define nonstd_lite_in_place_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> ) 175 #define nonstd_lite_in_place_type_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> ) 176 #define nonstd_lite_in_place_index_t(K) nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> ) 178 #define nonstd_lite_in_place( T) nonstd::in_place_type<T> 179 #define nonstd_lite_in_place_type( T) nonstd::in_place_type<T> 180 #define nonstd_lite_in_place_index(K) nonstd::in_place_index<K> 184 #endif // variant_CPP17_OR_GREATER 185 #endif // nonstd_lite_HAVE_IN_PLACE_TYPES 193 template< std::
size_t K >
196 template< std::
size_t K >
199 #define variant_index_tag_t(K) void(&)( nonstd::variants::detail::index_tag_t<K> ) 200 #define variant_index_tag(K) nonstd::variants::detail::index_tag<K> 210 #if variant_USES_STD_VARIANT 212 #include <functional> 215 #if ! variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 216 # define variant_size_V(T) nonstd::variant_size<T>::value 219 #if ! variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 220 # define variant_alternative_T(K,T) typename nonstd::variant_alternative<K,T >::type 226 using std::monostate;
227 using std::bad_variant_access;
228 using std::variant_size;
229 using std::variant_size_v;
230 using std::variant_alternative;
231 using std::variant_alternative_t;
238 using std::operator==;
239 using std::operator!=;
240 using std::operator<;
241 using std::operator<=;
242 using std::operator>;
243 using std::operator>=;
249 #else // variant_USES_STD_VARIANT 256 #if variant_CONFIG_NO_EXCEPTIONS 259 # include <stdexcept> 264 #define variant_CONFIG_MAX_TYPE_COUNT 16 265 #define variant_CONFIG_MAX_VISITOR_ARG_COUNT 5 269 #ifndef variant_CONFIG_MAX_ALIGN_HACK 270 # define variant_CONFIG_MAX_ALIGN_HACK 0 273 #ifndef variant_CONFIG_ALIGN_AS 277 #ifndef variant_CONFIG_ALIGN_AS_FALLBACK 278 # define variant_CONFIG_ALIGN_AS_FALLBACK double 282 #define variant_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) ) 298 #if defined(_MSC_VER ) && !defined(__clang__) 299 # define variant_COMPILER_MSVC_VER (_MSC_VER ) 300 # define variant_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) ) 302 # define variant_COMPILER_MSVC_VER 0 303 # define variant_COMPILER_MSVC_VERSION 0 306 #define variant_COMPILER_VERSION( major, minor, patch ) ( 10 * ( 10 * (major) + (minor) ) + (patch) ) 308 #if defined(__clang__) 309 # define variant_COMPILER_CLANG_VERSION variant_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) 311 # define variant_COMPILER_CLANG_VERSION 0 314 #if defined(__GNUC__) && !defined(__clang__) 315 # define variant_COMPILER_GNUC_VERSION variant_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 317 # define variant_COMPILER_GNUC_VERSION 0 320 #if variant_BETWEEN( variant_COMPILER_MSVC_VER, 1300, 1900 ) 321 # pragma warning( push ) 322 # pragma warning( disable: 4345 ) // initialization behavior changed 327 #define variant_HAVE( feature ) ( variant_HAVE_##feature ) 330 # define variant_HAS_CPP0X _HAS_CPP0X 332 # define variant_HAS_CPP0X 0 337 #if variant_COMPILER_MSVC_VER >= 1900 338 # undef variant_CPP11_OR_GREATER 339 # define variant_CPP11_OR_GREATER 1 342 #define variant_CPP11_90 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1500) 343 #define variant_CPP11_100 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1600) 344 #define variant_CPP11_110 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1700) 345 #define variant_CPP11_120 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1800) 346 #define variant_CPP11_140 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1900) 347 #define variant_CPP11_141 (variant_CPP11_OR_GREATER_ || variant_COMPILER_MSVC_VER >= 1910) 349 #define variant_CPP14_000 (variant_CPP14_OR_GREATER) 350 #define variant_CPP17_000 (variant_CPP17_OR_GREATER) 354 #define variant_HAVE_CONSTEXPR_11 variant_CPP11_140 355 #define variant_HAVE_INITIALIZER_LIST variant_CPP11_120 356 #define variant_HAVE_NOEXCEPT variant_CPP11_140 357 #define variant_HAVE_NULLPTR variant_CPP11_100 358 #define variant_HAVE_OVERRIDE variant_CPP11_140 362 #define variant_HAVE_CONSTEXPR_14 variant_CPP14_000 370 #define variant_HAVE_CONDITIONAL variant_CPP11_120 371 #define variant_HAVE_REMOVE_CV variant_CPP11_120 372 #define variant_HAVE_STD_ADD_POINTER variant_CPP11_90 373 #define variant_HAVE_TYPE_TRAITS variant_CPP11_90 374 #define variant_HAVE_ENABLE_IF variant_CPP11_90 375 #define variant_HAVE_IS_SAME variant_CPP11_90 377 #define variant_HAVE_TR1_TYPE_TRAITS (!! variant_COMPILER_GNUC_VERSION ) 378 #define variant_HAVE_TR1_ADD_POINTER (!! variant_COMPILER_GNUC_VERSION ) 382 #if variant_HAVE_CONSTEXPR_11 383 # define variant_constexpr constexpr 385 # define variant_constexpr 388 #if variant_HAVE_CONSTEXPR_14 389 # define variant_constexpr14 constexpr 391 # define variant_constexpr14 394 #if variant_HAVE_NOEXCEPT 395 # define variant_noexcept noexcept 397 # define variant_noexcept 400 #if variant_HAVE_NULLPTR 401 # define variant_nullptr nullptr 403 # define variant_nullptr NULL 406 #if variant_HAVE_OVERRIDE 407 # define variant_override override 409 # define variant_override 414 #if variant_CPP11_OR_GREATER 415 # include <functional> 418 #if variant_HAVE_INITIALIZER_LIST 419 # include <initializer_list> 422 #if variant_HAVE_TYPE_TRAITS 423 # include <type_traits> 424 #elif variant_HAVE_TR1_TYPE_TRAITS 425 # include <tr1/type_traits> 432 namespace nonstd {
namespace variants {
438 #if variant_HAVE_STD_ADD_POINTER 440 using std::add_pointer;
442 #elif variant_HAVE_TR1_ADD_POINTER 444 using std::tr1::add_pointer;
456 #endif // variant_HAVE_STD_ADD_POINTER 458 #if variant_HAVE_REMOVE_CV 460 using std::remove_cv;
476 #endif // variant_HAVE_REMOVE_CV 478 #if variant_HAVE_CONDITIONAL 480 using std::conditional;
484 template<
bool Cond,
class Then,
class Else >
487 template<
class Then,
class Else >
490 template<
class Then,
class Else >
493 #endif // variant_HAVE_CONDITIONAL 495 #if variant_HAVE_ENABLE_IF 497 using std::enable_if;
501 template<
bool B,
class T =
void >
507 #endif // variant_HAVE_ENABLE_IF 509 #if variant_HAVE_IS_SAME 515 template<
class T,
class U >
525 #endif // variant_HAVE_IS_SAME 531 #if variant_CPP11_OR_GREATER 533 #define variant_REQUIRES_T(...) \ 534 , typename std::enable_if< (__VA_ARGS__), int >::type = 0 536 #define variant_REQUIRES_R(R, ...) \ 537 typename std::enable_if< (__VA_ARGS__), R>::type 539 #define variant_REQUIRES_A(...) \ 540 , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr 542 #endif // variant_CPP11_OR_GREATER 544 #define variant_REQUIRES_0(...) \ 545 template< bool B = (__VA_ARGS__), typename std11::enable_if<B, int>::type = 0 > 547 #define variant_REQUIRES_B(...) \ 548 , bool B = (__VA_ARGS__), typename std11::enable_if<B, int>::type = 0 554 #if variant_CPP17_OR_GREATER 556 using std::is_swappable;
557 using std::is_nothrow_swappable;
559 #elif variant_CPP11_OR_GREATER 567 template<
typename T,
typename = decltype( swap( std::declval<T&>(), std::declval<T&>() ) ) >
574 struct is_nothrow_swappable
578 template<
typename T >
579 static constexpr
bool test()
581 return noexcept(
swap( std::declval<T&>(), std::declval<T&>() ) );
584 template<
typename T >
585 static auto test(
int ) -> std::integral_constant<bool, test<T>()>{}
595 template<
typename T >
596 struct is_swappable : decltype( detail::is_swappable::test<T>(0) ){};
598 template<
typename T >
599 struct is_nothrow_swappable : decltype( detail::is_nothrow_swappable::test<T>(0) ){};
601 #endif // variant_CPP17_OR_GREATER 611 #define variant_TL1( T1 ) detail::typelist< T1, detail::nulltype > 612 #define variant_TL2( T1, T2) detail::typelist< T1, variant_TL1( T2) > 613 #define variant_TL3( T1, T2, T3) detail::typelist< T1, variant_TL2( T2, T3) > 614 #define variant_TL4( T1, T2, T3, T4) detail::typelist< T1, variant_TL3( T2, T3, T4) > 615 #define variant_TL5( T1, T2, T3, T4, T5) detail::typelist< T1, variant_TL4( T2, T3, T4, T5) > 616 #define variant_TL6( T1, T2, T3, T4, T5, T6) detail::typelist< T1, variant_TL5( T2, T3, T4, T5, T6) > 617 #define variant_TL7( T1, T2, T3, T4, T5, T6, T7) detail::typelist< T1, variant_TL6( T2, T3, T4, T5, T6, T7) > 618 #define variant_TL8( T1, T2, T3, T4, T5, T6, T7, T8) detail::typelist< T1, variant_TL7( T2, T3, T4, T5, T6, T7, T8) > 619 #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) > 620 #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) > 621 #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) > 622 #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) > 623 #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) > 624 #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) > 625 #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) > 626 #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) > 642 template<
class U >
inline TX<T> operator* ( U
const & )
const {
return TX<T>(); }
643 template<
class U >
inline TX<T> operator/ ( U
const & )
const {
return TX<T>(); }
645 template<
class U >
inline TX<T> operator% ( U
const & )
const {
return TX<T>(); }
646 template<
class U >
inline TX<T> operator+ ( U
const & )
const {
return TX<T>(); }
647 template<
class U >
inline TX<T> operator- ( U
const & )
const {
return TX<T>(); }
653 inline bool operator< ( T
const & )
const {
return false; }
655 template<
class U >
inline TX<T> operator& ( U
const & )
const {
return TX<T>(); }
656 template<
class U >
inline TX<T> operator| ( U
const & )
const {
return TX<T>(); }
657 template<
class U >
inline TX<T> operator^ ( U
const & )
const {
return TX<T>(); }
659 template<
class U >
inline TX<T> operator&&( U
const & )
const {
return TX<T>(); }
683 template<
class Head,
class Tail >
692 template<
class List >
702 template<
class Head,
class Tail >
716 #if variant_CPP11_OR_GREATER 720 template<
class List >
721 struct typelist_max_alignof;
724 struct typelist_max_alignof<
nulltype >
729 template<
class Head,
class Tail >
730 struct typelist_max_alignof<
typelist<Head, Tail> >
736 enum V {
value = (
alignof( Head ) > tail_value) ?
alignof( Head ) :
std::size_t( tail_value ) };
743 template<
class List >
769 template<
class Head,
class Tail >
777 template<
class List,
class T >
786 template<
class Tail,
class T >
792 template<
class Head,
class Tail,
class T >
799 enum V {
value = nextVal == -1 ? -1 : 1 + nextVal } ;
804 template<
class List, std::
size_t i>
807 template<
class Head,
class Tail >
813 template<
class Head,
class Tail, std::
size_t i >
833 template<
class List, std::
size_t CmpIndex >
839 template<
class List,
class T >
844 #if variant_CONFIG_MAX_ALIGN_HACK 848 #define variant_UNIQUE( name ) variant_UNIQUE2( name, __LINE__ ) 849 #define variant_UNIQUE2( name, line ) variant_UNIQUE3( name, line ) 850 #define variant_UNIQUE3( name, line ) name ## line 852 #define variant_ALIGN_TYPE( type ) \ 853 type variant_UNIQUE( _t ); struct_t< type > variant_UNIQUE( _st ) 876 #ifdef HAVE_LONG_LONG 882 Unknown ( * variant_UNIQUE(_) )( Unknown );
883 Unknown * Unknown::* variant_UNIQUE(_);
884 Unknown ( Unknown::* variant_UNIQUE(_) )( Unknown );
891 #undef variant_UNIQUE 892 #undef variant_UNIQUE2 893 #undef variant_UNIQUE3 895 #undef variant_ALIGN_TYPE 897 #elif defined( variant_CONFIG_ALIGN_AS ) // variant_CONFIG_MAX_ALIGN_HACK 901 #define variant_ALIGN_AS( unused ) \ 902 variant_CONFIG_ALIGN_AS 904 #else // variant_CONFIG_MAX_ALIGN_HACK 908 #define variant_ALIGN_AS( to_align ) \ 909 typename detail::type_of_size< detail::alignment_types, detail::alignment_of< to_align >::value >::type 911 template<
typename T >
914 template<
typename T >
922 template<
size_t A,
size_t S >
928 template<
typename T >
935 template<
typename List,
size_t N >
939 N ==
sizeof(
typename List::head ),
950 template<
typename T>
953 #define variant_ALIGN_TYPE( type ) \ 954 typelist< type , typelist< struct_t< type > 980 > > > > > > > > > > > > > >
981 > > > > > > > > > > > > > >
985 #undef variant_ALIGN_TYPE 987 #endif // variant_CONFIG_MAX_ALIGN_HACK 989 #if variant_CPP11_OR_GREATER 991 template<
typename T>
994 return std::hash<T>()( v );
997 inline std::size_t hash( T0
const & ) {
return 0; }
998 inline std::size_t hash( T1
const & ) {
return 0; }
999 inline std::size_t hash( T2
const & ) {
return 0; }
1000 inline std::size_t hash( T3
const & ) {
return 0; }
1001 inline std::size_t hash( T4
const & ) {
return 0; }
1002 inline std::size_t hash( T5
const & ) {
return 0; }
1003 inline std::size_t hash( T6
const & ) {
return 0; }
1004 inline std::size_t hash( T7
const & ) {
return 0; }
1005 inline std::size_t hash( T8
const & ) {
return 0; }
1006 inline std::size_t hash( T9
const & ) {
return 0; }
1007 inline std::size_t hash( T10
const & ) {
return 0; }
1008 inline std::size_t hash( T11
const & ) {
return 0; }
1009 inline std::size_t hash( T12
const & ) {
return 0; }
1010 inline std::size_t hash( T13
const & ) {
return 0; }
1011 inline std::size_t hash( T14
const & ) {
return 0; }
1012 inline std::size_t hash( T15
const & ) {
return 0; }
1015 #endif // variant_CPP11_OR_GREATER 1021 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 >
1025 typedef variant_TL16( T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) variant_types;
1028 static U *
as(
void * data )
1030 return reinterpret_cast<U*
>( data );
1034 static U
const *
as(
void const * data )
1036 return reinterpret_cast<const U*
>( data );
1041 return static_cast<type_index_t
>( index );
1044 static void destroy( type_index_t index,
void * data )
1048 case 0: as<T0>( data )->~
T0();
break;
1049 case 1: as<T1>( data )->~
T1();
break;
1050 case 2: as<T2>( data )->~
T2();
break;
1051 case 3: as<T3>( data )->~
T3();
break;
1052 case 4: as<T4>( data )->~
T4();
break;
1053 case 5: as<T5>( data )->~
T5();
break;
1054 case 6: as<T6>( data )->~
T6();
break;
1055 case 7: as<T7>( data )->~
T7();
break;
1056 case 8: as<T8>( data )->~
T8();
break;
1057 case 9: as<T9>( data )->~
T9();
break;
1058 case 10: as<T10>( data )->~
T10();
break;
1059 case 11: as<T11>( data )->~
T11();
break;
1060 case 12: as<T12>( data )->~
T12();
break;
1061 case 13: as<T13>( data )->~
T13();
break;
1062 case 14: as<T14>( data )->~
T14();
break;
1063 case 15: as<T15>( data )->~
T15();
break;
1068 #if variant_CPP11_OR_GREATER 1069 template<
class T,
class... Args >
1070 static type_index_t construct_t(
void * data, Args&&... args )
1072 new( data ) T( std::forward<Args>(args)... );
1078 static type_index_t construct_i(
void * data, Args&&... args )
1082 construct_t< type >( data, std::forward<Args>(args)... );
1084 return to_index_t( K );
1087 static type_index_t move_construct( type_index_t
const from_index,
void * from_value,
void * to_value )
1089 switch ( from_index )
1091 case 0:
new( to_value )
T0(
std::move( *as<T0>( from_value ) ) );
break;
1092 case 1:
new( to_value )
T1(
std::move( *as<T1>( from_value ) ) );
break;
1093 case 2:
new( to_value )
T2(
std::move( *as<T2>( from_value ) ) );
break;
1094 case 3:
new( to_value )
T3(
std::move( *as<T3>( from_value ) ) );
break;
1095 case 4:
new( to_value )
T4(
std::move( *as<T4>( from_value ) ) );
break;
1096 case 5:
new( to_value )
T5(
std::move( *as<T5>( from_value ) ) );
break;
1097 case 6:
new( to_value )
T6(
std::move( *as<T6>( from_value ) ) );
break;
1098 case 7:
new( to_value )
T7(
std::move( *as<T7>( from_value ) ) );
break;
1099 case 8:
new( to_value )
T8(
std::move( *as<T8>( from_value ) ) );
break;
1100 case 9:
new( to_value )
T9(
std::move( *as<T9>( from_value ) ) );
break;
1101 case 10:
new( to_value )
T10(
std::move( *as<T10>( from_value ) ) );
break;
1102 case 11:
new( to_value )
T11(
std::move( *as<T11>( from_value ) ) );
break;
1103 case 12:
new( to_value )
T12(
std::move( *as<T12>( from_value ) ) );
break;
1104 case 13:
new( to_value )
T13(
std::move( *as<T13>( from_value ) ) );
break;
1105 case 14:
new( to_value )
T14(
std::move( *as<T14>( from_value ) ) );
break;
1106 case 15:
new( to_value )
T15(
std::move( *as<T15>( from_value ) ) );
break;
1112 static type_index_t move_assign( type_index_t
const from_index,
void * from_value,
void * to_value )
1114 switch ( from_index )
1116 case 0: *as<T0>( to_value ) =
std::move( *as<T0>( from_value ) );
break;
1117 case 1: *as<T1>( to_value ) =
std::move( *as<T1>( from_value ) );
break;
1118 case 2: *as<T2>( to_value ) =
std::move( *as<T2>( from_value ) );
break;
1119 case 3: *as<T3>( to_value ) =
std::move( *as<T3>( from_value ) );
break;
1120 case 4: *as<T4>( to_value ) =
std::move( *as<T4>( from_value ) );
break;
1121 case 5: *as<T5>( to_value ) =
std::move( *as<T5>( from_value ) );
break;
1122 case 6: *as<T6>( to_value ) =
std::move( *as<T6>( from_value ) );
break;
1123 case 7: *as<T7>( to_value ) =
std::move( *as<T7>( from_value ) );
break;
1124 case 8: *as<T8>( to_value ) =
std::move( *as<T8>( from_value ) );
break;
1125 case 9: *as<T9>( to_value ) =
std::move( *as<T9>( from_value ) );
break;
1126 case 10: *as<T10>( to_value ) =
std::move( *as<T10>( from_value ) );
break;
1127 case 11: *as<T11>( to_value ) =
std::move( *as<T11>( from_value ) );
break;
1128 case 12: *as<T12>( to_value ) =
std::move( *as<T12>( from_value ) );
break;
1129 case 13: *as<T13>( to_value ) =
std::move( *as<T13>( from_value ) );
break;
1130 case 14: *as<T14>( to_value ) =
std::move( *as<T14>( from_value ) );
break;
1131 case 15: *as<T15>( to_value ) =
std::move( *as<T15>( from_value ) );
break;
1138 static type_index_t
copy_construct( type_index_t
const from_index,
const void * from_value,
void * to_value )
1140 switch ( from_index )
1142 case 0:
new( to_value )
T0( *as<T0>( from_value ) );
break;
1143 case 1:
new( to_value )
T1( *as<T1>( from_value ) );
break;
1144 case 2:
new( to_value )
T2( *as<T2>( from_value ) );
break;
1145 case 3:
new( to_value )
T3( *as<T3>( from_value ) );
break;
1146 case 4:
new( to_value )
T4( *as<T4>( from_value ) );
break;
1147 case 5:
new( to_value )
T5( *as<T5>( from_value ) );
break;
1148 case 6:
new( to_value )
T6( *as<T6>( from_value ) );
break;
1149 case 7:
new( to_value )
T7( *as<T7>( from_value ) );
break;
1150 case 8:
new( to_value )
T8( *as<T8>( from_value ) );
break;
1151 case 9:
new( to_value )
T9( *as<T9>( from_value ) );
break;
1152 case 10:
new( to_value )
T10( *as<T10>( from_value ) );
break;
1153 case 11:
new( to_value )
T11( *as<T11>( from_value ) );
break;
1154 case 12:
new( to_value )
T12( *as<T12>( from_value ) );
break;
1155 case 13:
new( to_value )
T13( *as<T13>( from_value ) );
break;
1156 case 14:
new( to_value )
T14( *as<T14>( from_value ) );
break;
1157 case 15:
new( to_value )
T15( *as<T15>( from_value ) );
break;
1163 static type_index_t
copy_assign( type_index_t
const from_index,
const void * from_value,
void * to_value )
1165 switch ( from_index )
1167 case 0: *as<T0>( to_value ) = *as<T0>( from_value );
break;
1168 case 1: *as<T1>( to_value ) = *as<T1>( from_value );
break;
1169 case 2: *as<T2>( to_value ) = *as<T2>( from_value );
break;
1170 case 3: *as<T3>( to_value ) = *as<T3>( from_value );
break;
1171 case 4: *as<T4>( to_value ) = *as<T4>( from_value );
break;
1172 case 5: *as<T5>( to_value ) = *as<T5>( from_value );
break;
1173 case 6: *as<T6>( to_value ) = *as<T6>( from_value );
break;
1174 case 7: *as<T7>( to_value ) = *as<T7>( from_value );
break;
1175 case 8: *as<T8>( to_value ) = *as<T8>( from_value );
break;
1176 case 9: *as<T9>( to_value ) = *as<T9>( from_value );
break;
1177 case 10: *as<T10>( to_value ) = *as<T10>( from_value );
break;
1178 case 11: *as<T11>( to_value ) = *as<T11>( from_value );
break;
1179 case 12: *as<T12>( to_value ) = *as<T12>( from_value );
break;
1180 case 13: *as<T13>( to_value ) = *as<T13>( from_value );
break;
1181 case 14: *as<T14>( to_value ) = *as<T14>( from_value );
break;
1182 case 15: *as<T15>( to_value ) = *as<T15>( from_value );
break;
1195 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 >
1218 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 >
1219 struct variant_size<
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >
1221 enum _ {
value =
detail::typelist_size< variant_TL16(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) >::value };
1224 #if variant_CPP14_OR_GREATER 1229 #if ! variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 1230 # define variant_size_V(T) nonstd::variant_size<T>::value 1235 template< std::
size_t K,
class T >
1238 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 >
1239 struct variant_alternative< K,
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >
1241 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;
1244 #if variant_CPP11_OR_GREATER 1245 template< std::
size_t K,
class T >
1249 #if ! variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 1250 # define variant_alternative_T(K,T) typename nonstd::variant_alternative<K,T >::type 1258 #if variant_CPP11_OR_GREATER 1264 #if ! variant_CONFIG_NO_EXCEPTIONS 1268 class bad_variant_access :
public std::exception
1271 #if variant_CPP11_OR_GREATER 1274 virtual const char* what()
const throw()
1277 return "bad variant access";
1281 #endif // variant_CONFIG_NO_EXCEPTIONS 1305 typedef detail::helper< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > helper_type;
1306 typedef variant_TL16( T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) variant_types;
1313 #if variant_CPP11_OR_GREATER 1316 variant( T0
const & t0 ) : type_index( 0 ) {
new( ptr() )
T0( t0 ); }
1320 variant( T1
const & t1 ) : type_index( 1 ) {
new( ptr() )
T1( t1 ); }
1324 variant( T2
const & t2 ) : type_index( 2 ) {
new( ptr() )
T2( t2 ); }
1328 variant( T3
const & t3 ) : type_index( 3 ) {
new( ptr() )
T3( t3 ); }
1332 variant( T4
const & t4 ) : type_index( 4 ) {
new( ptr() )
T4( t4 ); }
1336 variant( T5
const & t5 ) : type_index( 5 ) {
new( ptr() )
T5( t5 ); }
1340 variant( T6
const & t6 ) : type_index( 6 ) {
new( ptr() )
T6( t6 ); }
1344 variant( T7
const & t7 ) : type_index( 7 ) {
new( ptr() )
T7( t7 ); }
1348 variant( T8
const & t8 ) : type_index( 8 ) {
new( ptr() )
T8( t8 ); }
1352 variant( T9
const & t9 ) : type_index( 9 ) {
new( ptr() )
T9( t9 ); }
1356 variant( T10
const & t10 ) : type_index( 10 ) {
new( ptr() )
T10( t10 ); }
1360 variant( T11
const & t11 ) : type_index( 11 ) {
new( ptr() )
T11( t11 ); }
1364 variant( T12
const & t12 ) : type_index( 12 ) {
new( ptr() )
T12( t12 ); }
1368 variant( T13
const & t13 ) : type_index( 13 ) {
new( ptr() )
T13( t13 ); }
1372 variant( T14
const & t14 ) : type_index( 14 ) {
new( ptr() )
T14( t14 ); }
1376 variant( T15
const & t15 ) : type_index( 15 ) {
new( ptr() )
T15( t15 ); }
1380 variant( T0
const & t0 ) : type_index( 0 ) {
new( ptr() )
T0( t0 ); }
1381 variant( T1
const & t1 ) : type_index( 1 ) {
new( ptr() )
T1( t1 ); }
1382 variant( T2
const & t2 ) : type_index( 2 ) {
new( ptr() )
T2( t2 ); }
1383 variant( T3
const & t3 ) : type_index( 3 ) {
new( ptr() )
T3( t3 ); }
1384 variant( T4
const & t4 ) : type_index( 4 ) {
new( ptr() )
T4( t4 ); }
1385 variant( T5
const & t5 ) : type_index( 5 ) {
new( ptr() )
T5( t5 ); }
1386 variant( T6
const & t6 ) : type_index( 6 ) {
new( ptr() )
T6( t6 ); }
1387 variant( T7
const & t7 ) : type_index( 7 ) {
new( ptr() )
T7( t7 ); }
1388 variant( T8
const & t8 ) : type_index( 8 ) {
new( ptr() )
T8( t8 ); }
1389 variant( T9
const & t9 ) : type_index( 9 ) {
new( ptr() )
T9( t9 ); }
1390 variant( T10
const & t10 ) : type_index( 10 ) {
new( ptr() )
T10( t10 ); }
1391 variant( T11
const & t11 ) : type_index( 11 ) {
new( ptr() )
T11( t11 ); }
1392 variant( T12
const & t12 ) : type_index( 12 ) {
new( ptr() )
T12( t12 ); }
1393 variant( T13
const & t13 ) : type_index( 13 ) {
new( ptr() )
T13( t13 ); }
1394 variant( T14
const & t14 ) : type_index( 14 ) {
new( ptr() )
T14( t14 ); }
1395 variant( T15
const & t15 ) : type_index( 15 ) {
new( ptr() )
T15( t15 ); }
1399 #if variant_CPP11_OR_GREATER 1403 : type_index( 0 ) {
new( ptr() )
T0(
std::move(t0) ); }
1408 : type_index( 1 ) {
new( ptr() )
T1(
std::move(t1) ); }
1413 : type_index( 2 ) {
new( ptr() )
T2(
std::move(t2) ); }
1418 : type_index( 3 ) {
new( ptr() )
T3(
std::move(t3) ); }
1423 : type_index( 4 ) {
new( ptr() )
T4(
std::move(t4) ); }
1428 : type_index( 5 ) {
new( ptr() )
T5(
std::move(t5) ); }
1433 : type_index( 6 ) {
new( ptr() )
T6(
std::move(t6) ); }
1438 : type_index( 7 ) {
new( ptr() )
T7(
std::move(t7) ); }
1443 : type_index( 8 ) {
new( ptr() )
T8(
std::move(t8) ); }
1448 : type_index( 9 ) {
new( ptr() )
T9(
std::move(t9) ); }
1453 : type_index( 10 ) {
new( ptr() )
T10(
std::move(t10) ); }
1458 : type_index( 11 ) {
new( ptr() )
T11(
std::move(t11) ); }
1463 : type_index( 12 ) {
new( ptr() )
T12(
std::move(t12) ); }
1468 : type_index( 13 ) {
new( ptr() )
T13(
std::move(t13) ); }
1473 : type_index( 14 ) {
new( ptr() )
T14(
std::move(t14) ); }
1478 : type_index( 15 ) {
new( ptr() )
T15(
std::move(t15) ); }
1482 : type_index( other.type_index )
1484 (void) helper_type::copy_construct( other.type_index, other.ptr(), ptr() );
1487 #if variant_CPP11_OR_GREATER 1506 : type_index( other.type_index )
1508 (void) helper_type::move_construct( other.type_index, other.ptr(), ptr() );
1511 template< std::
size_t K >
1514 template<
class T,
class... Args
1519 type_index = variant_npos_internal();
1520 type_index = helper_type::template construct_t<T>( ptr(), std::forward<Args>(args)... );
1523 template<
class T,
class U,
class... Args
1524 variant_REQUIRES_T( std::is_constructible< T, std::initializer_list<U>&, Args...>::
value )
1528 type_index = variant_npos_internal();
1529 type_index = helper_type::template construct_t<T>( ptr(), il, std::forward<Args>(args)... );
1533 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, Args...>::
value )
1537 type_index = variant_npos_internal();
1538 type_index = helper_type::template construct_i<K>( ptr(), std::forward<Args>(args)... );
1541 template<
size_t K,
class U,
class... Args
1542 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, std::initializer_list<U>&, Args...>::
value )
1546 type_index = variant_npos_internal();
1547 type_index = helper_type::template construct_i<K>( ptr(), il, std::forward<Args>(args)... );
1550 #endif // variant_CPP11_OR_GREATER 1556 if ( ! valueless_by_exception() )
1558 helper_type::destroy( type_index, ptr() );
1566 return copy_assign( other );
1569 #if variant_CPP11_OR_GREATER 1589 return move_assign(
std::move( other ) );
1594 variant & operator=( T0 && t0 ) {
return assign_value<0>(
std::move( t0 ) ); }
1598 variant & operator=( T1 && t1 ) {
return assign_value<1>(
std::move( t1 ) ); }
1602 variant & operator=( T2 && t2 ) {
return assign_value<2>(
std::move( t2 ) ); }
1606 variant & operator=( T3 && t3 ) {
return assign_value<3>(
std::move( t3 ) ); }
1610 variant & operator=( T4 && t4 ) {
return assign_value<4>(
std::move( t4 ) ); }
1614 variant & operator=( T5 && t5 ) {
return assign_value<5>(
std::move( t5 ) ); }
1618 variant & operator=( T6 && t6 ) {
return assign_value<6>(
std::move( t6 ) ); }
1622 variant & operator=( T7 && t7 ) {
return assign_value<7>(
std::move( t7 ) ); }
1626 variant & operator=( T8 && t8 ) {
return assign_value<8>(
std::move( t8 ) ); }
1630 variant & operator=( T9 && t9 ) {
return assign_value<9>(
std::move( t9 ) ); }
1634 variant & operator=( T10 && t10 ) {
return assign_value<10>(
std::move( t10 ) ); }
1638 variant & operator=( T11 && t11 ) {
return assign_value<11>(
std::move( t11 ) ); }
1642 variant & operator=( T12 && t12 ) {
return assign_value<12>(
std::move( t12 ) ); }
1646 variant & operator=( T13 && t13 ) {
return assign_value<13>(
std::move( t13 ) ); }
1650 variant & operator=( T14 && t14 ) {
return assign_value<14>(
std::move( t14 ) ); }
1654 variant & operator=( T15 && t15 ) {
return assign_value<15>(
std::move( t15 ) ); }
1658 #if variant_CPP11_OR_GREATER 1662 variant & operator=( T0
const & t0 ) {
return assign_value<0>( t0 ); }
1666 variant & operator=( T1
const & t1 ) {
return assign_value<1>( t1 ); }
1670 variant & operator=( T2
const & t2 ) {
return assign_value<2>( t2 ); }
1674 variant & operator=( T3
const & t3 ) {
return assign_value<3>( t3 ); }
1678 variant & operator=( T4
const & t4 ) {
return assign_value<4>( t4 ); }
1682 variant & operator=( T5
const & t5 ) {
return assign_value<5>( t5 ); }
1686 variant & operator=( T6
const & t6 ) {
return assign_value<6>( t6 ); }
1690 variant & operator=( T7
const & t7 ) {
return assign_value<7>( t7 ); }
1694 variant & operator=( T8
const & t8 ) {
return assign_value<8>( t8 ); }
1698 variant & operator=( T9
const & t9 ) {
return assign_value<9>( t9 ); }
1702 variant & operator=( T10
const & t10 ) {
return assign_value<10>( t10 ); }
1706 variant & operator=( T11
const & t11 ) {
return assign_value<11>( t11 ); }
1710 variant & operator=( T12
const & t12 ) {
return assign_value<12>( t12 ); }
1714 variant & operator=( T13
const & t13 ) {
return assign_value<13>( t13 ); }
1718 variant & operator=( T14
const & t14 ) {
return assign_value<14>( t14 ); }
1722 variant & operator=( T15
const & t15 ) {
return assign_value<15>( t15 ); }
1752 #if variant_CPP11_OR_GREATER 1754 template<
class T,
class... Args
1758 T& emplace( Args&&... args )
1760 helper_type::destroy( type_index, ptr() );
1761 type_index = variant_npos_internal();
1762 type_index = helper_type::template construct_t<T>( ptr(), std::forward<Args>(args)... );
1767 template<
class T,
class U,
class... Args
1768 variant_REQUIRES_T( std::is_constructible< T, std::initializer_list<U>&, Args...>::
value )
1771 T& emplace( std::initializer_list<U> il, Args&&... args )
1773 helper_type::destroy( type_index, ptr() );
1774 type_index = variant_npos_internal();
1775 type_index = helper_type::template construct_t<T>( ptr(), il, std::forward<Args>(args)... );
1780 template<
size_t K,
class... Args
1781 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, Args...>::
value )
1783 variant_alternative_t<K, variant> & emplace( Args&&... args )
1785 return this->
template emplace< type_at_t<K> >( std::forward<Args>(args)... );
1788 template<
size_t K,
class U,
class... Args
1789 variant_REQUIRES_T( std::is_constructible< type_at_t<K>, std::initializer_list<U>&, Args...>::
value )
1791 variant_alternative_t<K, variant> & emplace( std::initializer_list<U> il, Args&&... args )
1793 return this->
template emplace< type_at_t<K> >( il, std::forward<Args>(args)... );
1796 #endif // variant_CPP11_OR_GREATER 1802 return type_index == variant_npos_internal();
1808 #if variant_CPP11_OR_GREATER 1834 else if ( type_index == other.type_index )
1836 this->swap_value( type_index, other );
1840 #if variant_CPP11_OR_GREATER 1865 #if variant_CONFIG_NO_EXCEPTIONS 1866 assert( index_of<T>() == index() );
1868 if ( index_of<T>() != index() )
1870 throw bad_variant_access();
1877 T
const &
get()
const 1879 #if variant_CONFIG_NO_EXCEPTIONS 1880 assert( index_of<T>() == index() );
1882 if ( index_of<T>() != index() )
1884 throw bad_variant_access();
1887 return *as<const T>();
1890 template< std::
size_t K >
1894 return this->
template get< typename detail::typelist_type_at< variant_types, K >::type >();
1897 template< std::
size_t K >
1901 return this->
template get< typename detail::typelist_type_at< variant_types, K >::type >();
1920 return reinterpret_cast<U*
>( ptr() );
1924 U
const * as()
const 1926 return reinterpret_cast<U
const *
>( ptr() );
1937 return static_cast<type_index_t
>( -1 );
1948 helper_type::destroy( type_index, ptr() );
1949 type_index = variant_npos_internal();
1951 else if ( index() == other.
index() )
1953 type_index = helper_type::copy_assign( other.type_index, other.ptr(), ptr() );
1957 helper_type::destroy( type_index, ptr() );
1958 type_index = variant_npos_internal();
1959 type_index = helper_type::copy_construct( other.type_index, other.ptr(), ptr() );
1964 #if variant_CPP11_OR_GREATER 1974 helper_type::destroy( type_index, ptr() );
1975 type_index = variant_npos_internal();
1977 else if ( index() == other.
index() )
1979 type_index = helper_type::move_assign( other.type_index, other.ptr(), ptr() );
1983 helper_type::destroy( type_index, ptr() );
1984 type_index = variant_npos_internal();
1985 type_index = helper_type::move_construct( other.type_index, other.ptr(), ptr() );
1990 template< std::
size_t K,
class T >
1995 *as<T>() = std::forward<T>(
value );
1999 helper_type::destroy( type_index, ptr() );
2000 type_index = variant_npos_internal();
2001 new( ptr() ) T( std::forward<T>(
value ) );
2007 #endif // variant_CPP11_OR_GREATER 2009 template< std::
size_t K,
class T >
2018 helper_type::destroy( type_index, ptr() );
2019 type_index = variant_npos_internal();
2020 new( ptr() ) T( value );
2026 void swap_value( type_index_t index,
variant & other )
2031 case 0:
swap( this->get<0>(), other.
get<0>() );
break;
2032 case 1:
swap( this->get<1>(), other.
get<1>() );
break;
2033 case 2:
swap( this->get<2>(), other.
get<2>() );
break;
2034 case 3:
swap( this->get<3>(), other.
get<3>() );
break;
2035 case 4:
swap( this->get<4>(), other.
get<4>() );
break;
2036 case 5:
swap( this->get<5>(), other.
get<5>() );
break;
2037 case 6:
swap( this->get<6>(), other.
get<6>() );
break;
2038 case 7:
swap( this->get<7>(), other.
get<7>() );
break;
2039 case 8:
swap( this->get<8>(), other.
get<8>() );
break;
2040 case 9:
swap( this->get<9>(), other.
get<9>() );
break;
2041 case 10:
swap( this->get<10>(), other.
get<10>() );
break;
2042 case 11:
swap( this->get<11>(), other.
get<11>() );
break;
2043 case 12:
swap( this->get<12>(), other.
get<12>() );
break;
2044 case 13:
swap( this->get<13>(), other.
get<13>() );
break;
2045 case 14:
swap( this->get<14>(), other.
get<14>() );
break;
2046 case 15:
swap( this->get<15>(), other.
get<15>() );
break;
2054 #if variant_CPP11_OR_GREATER 2058 using aligned_storage_t =
typename std::aligned_storage< data_size, data_align >::type;
2059 aligned_storage_t data;
2061 #elif variant_CONFIG_MAX_ALIGN_HACK 2063 typedef union {
unsigned char data[ data_size ]; } aligned_storage_t;
2065 detail::max_align_t hack;
2066 aligned_storage_t data;
2073 typedef union { align_as_type data[ 1 + ( data_size - 1 ) /
sizeof(align_as_type) ]; } aligned_storage_t;
2074 aligned_storage_t data;
2078 #endif // variant_CONFIG_MAX_ALIGN_HACK 2080 type_index_t type_index;
2085 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 >
2086 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 2088 return v.index() ==
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::template index_of<T>();
2091 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 >
2092 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) )
2094 return v.template get<R>();
2097 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 >
2098 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) )
2100 return v.template get<R>();
2103 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 >
2104 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type &
2105 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) )
2107 #if variant_CONFIG_NO_EXCEPTIONS 2108 assert( K == v.
index() );
2110 if ( K != v.
index() )
2112 throw bad_variant_access();
2115 return v.template get<K>();
2118 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 >
2119 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type
const &
2120 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) )
2122 #if variant_CONFIG_NO_EXCEPTIONS 2123 assert( K == v.
index() );
2125 if ( K != v.
index() )
2127 throw bad_variant_access();
2130 return v.template get<K>();
2133 #if variant_CPP11_OR_GREATER 2135 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 >
2136 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) )
2141 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 >
2142 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) )
2147 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 >
2148 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type &&
2149 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) )
2151 #if variant_CONFIG_NO_EXCEPTIONS 2152 assert( K == v.index() );
2154 if ( K != v.index() )
2156 throw bad_variant_access();
2162 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 >
2163 inline typename variant_alternative< K, variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::type
const &&
2164 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) )
2166 #if variant_CONFIG_NO_EXCEPTIONS 2167 assert( K == v.index() );
2169 if ( K != v.index() )
2171 throw bad_variant_access();
2177 #endif // variant_CPP11_OR_GREATER 2179 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 >
2181 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) )
2183 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;
2186 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 >
2188 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))
2190 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;
2193 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 >
2194 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
2195 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) )
2200 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 >
2201 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
2202 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) )
2209 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
2210 #if variant_CPP11_OR_GREATER 2232 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> & a,
2233 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> & b )
2234 #if variant_CPP11_OR_GREATER 2235 noexcept( noexcept( a.
swap( b ) ) )
2248 template<
typename R,
typename VT >
2251 template<
typename Visitor,
typename T >
2252 static R
apply(Visitor
const& v, T
const& arg)
2258 template<
typename R,
typename VT >
2261 template<
typename Visitor,
typename T >
2269 template<
typename R>
2272 template<
typename R,
typename Visitor,
typename V1 >
2275 #if variant_CPP11_OR_GREATER 2276 template<
size_t NumVars,
typename R,
typename Visitor,
typename ... T >
2278 template<
size_t NumVars,
typename R,
typename Visitor,
typename T1,
typename T2 = S0,
typename T3 = S0,
typename T4 = S0,
typename T5 = S0 >
2282 template<
typename R,
typename Visitor,
typename T2 >
2295 template<
typename T>
2298 return visitor(val1, val2);
2302 template<
typename R,
typename Visitor,
typename T2,
typename T3 >
2317 template<
typename T>
2320 return visitor(val1, val2, val3);
2324 template<
typename R,
typename Visitor,
typename T2,
typename T3,
typename T4 >
2341 template<
typename T>
2344 return visitor(val1, val2, val3, val4);
2348 template<
typename R,
typename Visitor,
typename T2,
typename T3,
typename T4,
typename T5 >
2367 template<
typename T>
2370 return visitor(val1, val2, val3, val4, val5);
2376 template<
typename R,
typename Visitor,
typename V2>
2389 template<
typename T1 >
2396 template<
typename T1,
typename T2 >
2403 template<
typename T1,
typename T2,
typename T3 >
2404 R
operator()(T1
const& val1, T2
const& val2, T3
const& val3)
const 2410 template<
typename T1,
typename T2,
typename T3,
typename T4 >
2411 R
operator()(T1
const& val1, T2
const& val2, T3
const& val3, T4
const& val4)
const 2417 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5 >
2418 R
operator()(T1
const& val1, T2
const& val2, T3
const& val3, T4
const& val4, T5
const& val5)
const 2427 template<
typename R>
2430 template<
typename Visitor,
typename V1>
2431 static R
apply(
const Visitor& v,
const V1& arg)
2433 switch( arg.index() )
2435 case 0:
return apply_visitor<0>(v, arg);
2436 case 1:
return apply_visitor<1>(v, arg);
2437 case 2:
return apply_visitor<2>(v, arg);
2438 case 3:
return apply_visitor<3>(v, arg);
2439 case 4:
return apply_visitor<4>(v, arg);
2440 case 5:
return apply_visitor<5>(v, arg);
2441 case 6:
return apply_visitor<6>(v, arg);
2442 case 7:
return apply_visitor<7>(v, arg);
2443 case 8:
return apply_visitor<8>(v, arg);
2444 case 9:
return apply_visitor<9>(v, arg);
2445 case 10:
return apply_visitor<10>(v, arg);
2446 case 11:
return apply_visitor<11>(v, arg);
2447 case 12:
return apply_visitor<12>(v, arg);
2448 case 13:
return apply_visitor<13>(v, arg);
2449 case 14:
return apply_visitor<14>(v, arg);
2450 case 15:
return apply_visitor<15>(v, arg);
2453 default: std::terminate();
2457 template<
size_t Idx,
typename Visitor,
typename V1>
2461 #if variant_CPP11_OR_GREATER 2469 #if variant_CPP11_OR_GREATER 2470 template<
typename Visitor,
typename V1,
typename V2,
typename ... V>
2471 static R apply(
const Visitor& v,
const V1& arg1,
const V2& arg2,
const V ... args)
2474 Unwrapper unwrapper(v, arg1);
2475 return apply(unwrapper, arg2, args ...);
2479 template<
typename Visitor,
typename V1,
typename V2 >
2480 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2)
2483 Unwrapper unwrapper(v, arg1);
2484 return apply(unwrapper, arg2);
2487 template<
typename Visitor,
typename V1,
typename V2,
typename V3 >
2488 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3)
2491 Unwrapper unwrapper(v, arg1);
2492 return apply(unwrapper, arg2, arg3);
2495 template<
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4 >
2496 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4)
2499 Unwrapper unwrapper(v, arg1);
2500 return apply(unwrapper, arg2, arg3, arg4);
2503 template<
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4,
typename V5 >
2504 static R
apply(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4, V5
const& arg5)
2507 Unwrapper unwrapper(v, arg1);
2508 return apply(unwrapper, arg2, arg3, arg4, arg5);
2514 #if variant_CPP11_OR_GREATER 2515 template<
size_t NumVars,
typename Visitor,
typename ... V >
2518 typedef decltype(std::declval<Visitor>()(get<0>(static_cast<const V&>(std::declval<V>()))...)) result_type;
2524 #if variant_CPP11_OR_GREATER 2526 template<
typename Visitor,
typename ... V >
2527 inline auto visit(Visitor
const& v, V
const& ... vars) ->
typename detail::VisitorImpl<
sizeof ... (V), Visitor, V... > ::result_type
2529 typedef detail::VisitorImpl<sizeof ... (V), Visitor, V... > impl_type;
2530 return impl_type::applicator_type::apply(v, vars...);
2534 template<
typename R,
typename Visitor,
typename V1 >
2535 inline R
visit(
const Visitor& v, V1
const& arg1)
2540 template<
typename R,
typename Visitor,
typename V1,
typename V2 >
2541 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2)
2546 template<
typename R,
typename Visitor,
typename V1,
typename V2,
typename V3 >
2547 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3)
2552 template<
typename R,
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4 >
2553 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4)
2558 template<
typename R,
typename Visitor,
typename V1,
typename V2,
typename V3,
typename V4,
typename V5 >
2559 inline R
visit(
const Visitor& v, V1
const& arg1, V2
const& arg2, V3
const& arg3, V4
const& arg4, V5
const& arg5)
2570 template<
class Variant >
2573 static inline bool equal( Variant
const & v, Variant
const & w )
2577 case 0:
return get<0>( v ) == get<0>( w );
2578 case 1:
return get<1>( v ) == get<1>( w );
2579 case 2:
return get<2>( v ) == get<2>( w );
2580 case 3:
return get<3>( v ) == get<3>( w );
2581 case 4:
return get<4>( v ) == get<4>( w );
2582 case 5:
return get<5>( v ) == get<5>( w );
2583 case 6:
return get<6>( v ) == get<6>( w );
2584 case 7:
return get<7>( v ) == get<7>( w );
2585 case 8:
return get<8>( v ) == get<8>( w );
2586 case 9:
return get<9>( v ) == get<9>( w );
2587 case 10:
return get<10>( v ) == get<10>( w );
2588 case 11:
return get<11>( v ) == get<11>( w );
2589 case 12:
return get<12>( v ) == get<12>( w );
2590 case 13:
return get<13>( v ) == get<13>( w );
2591 case 14:
return get<14>( v ) == get<14>( w );
2592 case 15:
return get<15>( v ) == get<15>( w );
2594 default:
return false;
2598 static inline bool less_than( Variant
const & v, Variant
const & w )
2602 case 0:
return get<0>( v ) < get<0>( w );
2603 case 1:
return get<1>( v ) < get<1>( w );
2604 case 2:
return get<2>( v ) < get<2>( w );
2605 case 3:
return get<3>( v ) < get<3>( w );
2606 case 4:
return get<4>( v ) < get<4>( w );
2607 case 5:
return get<5>( v ) < get<5>( w );
2608 case 6:
return get<6>( v ) < get<6>( w );
2609 case 7:
return get<7>( v ) < get<7>( w );
2610 case 8:
return get<8>( v ) < get<8>( w );
2611 case 9:
return get<9>( v ) < get<9>( w );
2612 case 10:
return get<10>( v ) < get<10>( w );
2613 case 11:
return get<11>( v ) < get<11>( w );
2614 case 12:
return get<12>( v ) < get<12>( w );
2615 case 13:
return get<13>( v ) < get<13>( w );
2616 case 14:
return get<14>( v ) < get<14>( w );
2617 case 15:
return get<15>( v ) < get<15>( w );
2619 default:
return false;
2626 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 >
2628 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2629 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2633 else return detail::Comparator< variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >::equal( v, w );
2636 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 >
2638 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2639 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2641 return ! ( v == w );
2644 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 >
2646 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2647 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2651 else if ( v.
index() < w.
index() )
return true;
2652 else if ( v.
index() > w.
index() )
return false;
2653 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 );
2656 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 >
2658 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2659 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2664 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 >
2666 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2667 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2672 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 >
2674 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & v,
2675 variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> const & w )
2682 using namespace variants;
2686 #if variant_CPP11_OR_GREATER 2701 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 >
2702 struct hash< nonstd::
variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> >
2704 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 2710 case 0:
return nvd::hash( 0 ) ^ nvd::hash( get<0>( v ) );
2711 case 1:
return nvd::hash( 1 ) ^ nvd::hash( get<1>( v ) );
2712 case 2:
return nvd::hash( 2 ) ^ nvd::hash( get<2>( v ) );
2713 case 3:
return nvd::hash( 3 ) ^ nvd::hash( get<3>( v ) );
2714 case 4:
return nvd::hash( 4 ) ^ nvd::hash( get<4>( v ) );
2715 case 5:
return nvd::hash( 5 ) ^ nvd::hash( get<5>( v ) );
2716 case 6:
return nvd::hash( 6 ) ^ nvd::hash( get<6>( v ) );
2717 case 7:
return nvd::hash( 7 ) ^ nvd::hash( get<7>( v ) );
2718 case 8:
return nvd::hash( 8 ) ^ nvd::hash( get<8>( v ) );
2719 case 9:
return nvd::hash( 9 ) ^ nvd::hash( get<9>( v ) );
2720 case 10:
return nvd::hash( 10 ) ^ nvd::hash( get<10>( v ) );
2721 case 11:
return nvd::hash( 11 ) ^ nvd::hash( get<11>( v ) );
2722 case 12:
return nvd::hash( 12 ) ^ nvd::hash( get<12>( v ) );
2723 case 13:
return nvd::hash( 13 ) ^ nvd::hash( get<13>( v ) );
2724 case 14:
return nvd::hash( 14 ) ^ nvd::hash( get<14>( v ) );
2725 case 15:
return nvd::hash( 15 ) ^ nvd::hash( get<15>( v ) );
2734 #endif // variant_CPP11_OR_GREATER 2736 #if variant_BETWEEN( variant_COMPILER_MSVC_VER, 1300, 1900 ) 2737 # pragma warning( pop ) 2740 #endif // variant_USES_STD_VARIANT 2742 #endif // NONSTD_VARIANT_LITE_HPP
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_)
#define variant_ALIGN_AS(to_align)
bool_constant< false > false_type
#define nonstd_lite_in_place_index_t(K)
#define variant_REQUIRES_B(...)
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)
std::ostream & operator<<(std::ostream &os, const Face &face)
span_CONFIG_SIZE_TYPE size_t
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3)
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)
variant(variant const &other)
void index_tag(index_tag_t< K >=index_tag_t< K >())
#define variant_constexpr
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_)
R operator()(T1 const &val1, T2 const &val2, T3 const &val3) 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< variant_TL16(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15), K >::type type
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)
bool valueless_by_exception() const
#define nonstd_lite_in_place_index(K)
variant & operator=(variant const &other)
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
#define variant_ALIGN_TYPE(type)
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
#define nonstd_lite_in_place_type_t(T)
remove_volatile< typename remove_const< T >::type >::type type
remove_reference< T >::type * type
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
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=(T11 const &t11)
#define variant_index_tag(K)
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)
#define variant_TL16(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)
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)
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_, T4 const &val4_, T5 const &val5_)
#define variant_CONFIG_ALIGN_AS_FALLBACK
variant_CONFIG_ALIGN_AS_FALLBACK type
#define variant_index_tag_t(K)
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_, T4 const &val4_)
static variant_constexpr std::size_t index_of() variant_noexcept
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)
in_place_t in_place_type(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
bool_constant< true > true_type
bool holds_alternative(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v) variant_noexcept
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
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_lite_in_place_index_t(K)=nonstd_lite_in_place_index(K))
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
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_lite_in_place_index_t(K)=nonstd_lite_in_place_index(K))
static R apply(const Visitor &v, const V1 &arg)
variant & operator=(T15 const &t15)
#define nonstd_lite_in_place_type(T)
Unit testing utility error code.
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)
variant & operator=(T10 const &t10)