NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
variant.hpp
Go to the documentation of this file.
1 // Copyright 2016-2018 by Martin Moene
2 //
3 // https://github.com/martinmoene/variant-lite
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 
8 #pragma once
9 
10 #ifndef NONSTD_VARIANT_LITE_HPP
11 #define NONSTD_VARIANT_LITE_HPP
12 
13 #define variant_lite_MAJOR 1
14 #define variant_lite_MINOR 1
15 #define variant_lite_PATCH 0
16 
17 #define variant_lite_VERSION variant_STRINGIFY(variant_lite_MAJOR) "." variant_STRINGIFY(variant_lite_MINOR) "." variant_STRINGIFY(variant_lite_PATCH)
18 
19 #define variant_STRINGIFY( x ) variant_STRINGIFY_( x )
20 #define variant_STRINGIFY_( x ) #x
21 
22 // variant-lite configuration:
23 
24 #define variant_VARIANT_DEFAULT 0
25 #define variant_VARIANT_NONSTD 1
26 #define variant_VARIANT_STD 2
27 
28 #if !defined( variant_CONFIG_SELECT_VARIANT )
29 # define variant_CONFIG_SELECT_VARIANT ( variant_HAVE_STD_VARIANT ? variant_VARIANT_STD : variant_VARIANT_NONSTD )
30 #endif
31 
32 #ifndef variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO
33 # define variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO 0
34 #endif
35 
36 #ifndef variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO
37 # define variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 0
38 #endif
39 
40 // Control presence of exception handling (try and auto discover):
41 
42 #ifndef variant_CONFIG_NO_EXCEPTIONS
43 # if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
44 # define variant_CONFIG_NO_EXCEPTIONS 0
45 # else
46 # define variant_CONFIG_NO_EXCEPTIONS 1
47 # endif
48 #endif
49 
50 // C++ language version detection (C++20 is speculative):
51 // Note: VC14.0/1900 (VS2015) lacks too much from C++14.
52 
53 #ifndef variant_CPLUSPLUS
54 # if defined(_MSVC_LANG ) && !defined(__clang__)
55 # define variant_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG )
56 # else
57 # define variant_CPLUSPLUS __cplusplus
58 # endif
59 #endif
60 
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 )
67 
68 // Use C++17 std::variant if available and requested:
69 
70 #if variant_CPP17_OR_GREATER && defined(__has_include )
71 # if __has_include( <variant> )
72 # define variant_HAVE_STD_VARIANT 1
73 # else
74 # define variant_HAVE_STD_VARIANT 0
75 # endif
76 #else
77 # define variant_HAVE_STD_VARIANT 0
78 #endif
79 
80 #define variant_USES_STD_VARIANT ( (variant_CONFIG_SELECT_VARIANT == variant_VARIANT_STD) || ((variant_CONFIG_SELECT_VARIANT == variant_VARIANT_DEFAULT) && variant_HAVE_STD_VARIANT) )
81 
82 //
83 // in_place: code duplicated in any-lite, expected-lite, optional-lite, value-ptr-lite, variant-lite:
84 //
85 
86 #ifndef nonstd_lite_HAVE_IN_PLACE_TYPES
87 #define nonstd_lite_HAVE_IN_PLACE_TYPES 1
88 
89 // C++17 std::in_place in <utility>:
90 
91 #if variant_CPP17_OR_GREATER
92 
93 #include <utility>
94 
95 namespace nonstd {
96 
97 using std::in_place;
98 using std::in_place_type;
100 using std::in_place_t;
101 using std::in_place_type_t;
102 using std::in_place_index_t;
103 
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>
107 
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>{}
111 
112 } // namespace nonstd
113 
114 #else // variant_CPP17_OR_GREATER
115 
116 #include <cstddef>
117 
118 namespace nonstd {
119 namespace detail {
120 
121 template< class T >
122 struct in_place_type_tag {};
123 
124 template< std::size_t K >
125 struct in_place_index_tag {};
126 
127 } // namespace detail
128 
129 struct in_place_t {};
130 
131 template< class T >
132 inline in_place_t in_place( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
133 {
134  return in_place_t();
135 }
136 
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>() )
139 {
140  return in_place_t();
141 }
142 
143 template< class T >
144 inline in_place_t in_place_type( detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() )
145 {
146  return in_place_t();
147 }
148 
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>() )
151 {
152  return in_place_t();
153 }
154 
155 // mimic templated typedef:
156 
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> )
160 
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>
164 
165 } // namespace nonstd
166 
167 #endif // variant_CPP17_OR_GREATER
168 #endif // nonstd_lite_HAVE_IN_PLACE_TYPES
169 
170 //
171 // Use C++17 std::variant:
172 //
173 
174 #if variant_USES_STD_VARIANT
175 
176 #include <functional> // std::hash<>
177 #include <variant>
178 
179 #if ! variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO
180 # define variant_size_V(T) nonstd::variant_size<T>::value
181 #endif
182 
183 #if ! variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO
184 # define variant_alternative_T(K,T) typename nonstd::variant_alternative<K,T >::type
185 #endif
186 
187 namespace nonstd {
188 
189  using std::variant;
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;
196  using std::hash;
197 
198  using std::visit;
200  using std::get;
201  using std::get_if;
202  using std::operator==;
203  using std::operator!=;
204  using std::operator<;
205  using std::operator<=;
206  using std::operator>;
207  using std::operator>=;
208  using std::swap;
209 
210  constexpr auto variant_npos = std::variant_npos;
211 }
212 
213 #else // variant_USES_STD_VARIANT
214 
215 #include <cstddef>
216 #include <limits>
217 #include <new>
218 #include <utility>
219 
220 #if variant_CONFIG_NO_EXCEPTIONS
221 # include <cassert>
222 #else
223 # include <stdexcept>
224 #endif
225 
226 // variant-lite type and visitor argument count configuration (script/generate_header.py):
227 
228 #define variant_CONFIG_MAX_TYPE_COUNT 16
229 #define variant_CONFIG_MAX_VISITOR_ARG_COUNT 5
230 
231 // variant-lite alignment configuration:
232 
233 #ifndef variant_CONFIG_MAX_ALIGN_HACK
234 # define variant_CONFIG_MAX_ALIGN_HACK 0
235 #endif
236 
237 #ifndef variant_CONFIG_ALIGN_AS
238 // no default, used in #if defined()
239 #endif
240 
241 #ifndef variant_CONFIG_ALIGN_AS_FALLBACK
242 # define variant_CONFIG_ALIGN_AS_FALLBACK double
243 #endif
244 
245 // half-open range [lo..hi):
246 #define variant_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) )
247 
248 // Compiler versions:
249 //
250 // MSVC++ 6.0 _MSC_VER == 1200 (Visual Studio 6.0)
251 // MSVC++ 7.0 _MSC_VER == 1300 (Visual Studio .NET 2002)
252 // MSVC++ 7.1 _MSC_VER == 1310 (Visual Studio .NET 2003)
253 // MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
254 // MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
255 // MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
256 // MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
257 // MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
258 // MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
259 // MSVC++ 14.1 _MSC_VER >= 1910 (Visual Studio 2017)
260 
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 ) ) )
264 #else
265 # define variant_COMPILER_MSVC_VER 0
266 # define variant_COMPILER_MSVC_VERSION 0
267 #endif
268 
269 #define variant_COMPILER_VERSION( major, minor, patch ) ( 10 * ( 10 * (major) + (minor) ) + (patch) )
270 
271 #if defined(__clang__)
272 # define variant_COMPILER_CLANG_VERSION variant_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
273 #else
274 # define variant_COMPILER_CLANG_VERSION 0
275 #endif
276 
277 #if defined(__GNUC__) && !defined(__clang__)
278 # define variant_COMPILER_GNUC_VERSION variant_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
279 #else
280 # define variant_COMPILER_GNUC_VERSION 0
281 #endif
282 
283 #if variant_BETWEEN( variant_COMPILER_MSVC_VER, 1300, 1900 )
284 # pragma warning( push )
285 # pragma warning( disable: 4345 ) // initialization behavior changed
286 #endif
287 
288 // Presence of language and library features:
289 
290 #define variant_HAVE( feature ) ( variant_HAVE_##feature )
291 
292 #ifdef _HAS_CPP0X
293 # define variant_HAS_CPP0X _HAS_CPP0X
294 #else
295 # define variant_HAS_CPP0X 0
296 #endif
297 
298 // Unless defined otherwise below, consider VC14 as C++11 for variant-lite:
299 
300 #if variant_COMPILER_MSVC_VER >= 1900
301 # undef variant_CPP11_OR_GREATER
302 # define variant_CPP11_OR_GREATER 1
303 #endif
304 
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)
311 
312 #define variant_CPP14_000 (variant_CPP14_OR_GREATER)
313 #define variant_CPP17_000 (variant_CPP17_OR_GREATER)
314 
315 // Presence of C++11 language features:
316 
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
322 
323 // Presence of C++14 language features:
324 
325 #define variant_HAVE_CONSTEXPR_14 variant_CPP14_000
326 
327 // Presence of C++17 language features:
328 
329 // no flag
330 
331 // Presence of C++ library features:
332 
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
337 
338 #define variant_HAVE_TR1_TYPE_TRAITS (!! variant_COMPILER_GNUC_VERSION )
339 #define variant_HAVE_TR1_ADD_POINTER (!! variant_COMPILER_GNUC_VERSION )
340 
341 // C++ feature usage:
342 
343 #if variant_HAVE_CONSTEXPR_11
344 # define variant_constexpr constexpr
345 #else
346 # define variant_constexpr /*constexpr*/
347 #endif
348 
349 #if variant_HAVE_CONSTEXPR_14
350 # define variant_constexpr14 constexpr
351 #else
352 # define variant_constexpr14 /*constexpr*/
353 #endif
354 
355 #if variant_HAVE_NOEXCEPT
356 # define variant_noexcept noexcept
357 #else
358 # define variant_noexcept /*noexcept*/
359 #endif
360 
361 #if variant_HAVE_NULLPTR
362 # define variant_nullptr nullptr
363 #else
364 # define variant_nullptr NULL
365 #endif
366 
367 #if variant_HAVE_OVERRIDE
368 # define variant_override override
369 #else
370 # define variant_override /*override*/
371 #endif
372 
373 // additional includes:
374 
375 #if variant_CPP11_OR_GREATER
376 # include <functional> // std::hash
377 #endif
378 
379 #if variant_HAVE_INITIALIZER_LIST
380 # include <initializer_list>
381 #endif
382 
383 #if variant_HAVE_TYPE_TRAITS
384 # include <type_traits>
385 #elif variant_HAVE_TR1_TYPE_TRAITS
386 # include <tr1/type_traits>
387 #endif
388 
389 // Method enabling
390 
391 #if variant_CPP11_OR_GREATER
392 
393 #define variant_REQUIRES_0(...) \
394  template< bool B = (__VA_ARGS__), typename std::enable_if<B, int>::type = 0 >
395 
396 #define variant_REQUIRES_T(...) \
397  , typename = typename std::enable_if< (__VA_ARGS__), nonstd::variants::detail::enabler >::type
398 
399 #define variant_REQUIRES_R(R, ...) \
400  typename std::enable_if< (__VA_ARGS__), R>::type
401 
402 #define variant_REQUIRES_A(...) \
403  , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr
404 
405 #endif
406 
407 //
408 // variant:
409 //
410 
411 namespace nonstd { namespace variants {
412 
413 // C++11 emulation:
414 
415 namespace std11 {
416 
417 #if variant_HAVE_STD_ADD_POINTER
418 
419 using std::add_pointer;
420 
421 #elif variant_HAVE_TR1_ADD_POINTER
422 
423 using std::tr1::add_pointer;
424 
425 #else
426 
427 template< class T > struct remove_reference { typedef T type; };
428 template< class T > struct remove_reference<T&> { typedef T type; };
429 
430 template< class T > struct add_pointer
431 {
432  typedef typename remove_reference<T>::type * type;
433 };
434 
435 #endif // variant_HAVE_STD_ADD_POINTER
436 
437 #if variant_HAVE_REMOVE_CV
438 
439 using std::remove_cv;
440 
441 #else
442 
443 template< class T > struct remove_const { typedef T type; };
444 template< class T > struct remove_const<const T> { typedef T type; };
445 
446 template< class T > struct remove_volatile { typedef T type; };
447 template< class T > struct remove_volatile<volatile T> { typedef T type; };
448 
449 template< class T >
450 struct remove_cv
451 {
453 };
454 
455 #endif // variant_HAVE_REMOVE_CV
456 
457 #if variant_HAVE_CONDITIONAL
458 
459 using std::conditional;
460 
461 #else
462 
463 template< bool Cond, class Then, class Else >
464 struct conditional;
465 
466 template< class Then, class Else >
467 struct conditional< true , Then, Else > { typedef Then type; };
468 
469 template< class Then, class Else >
470 struct conditional< false, Then, Else > { typedef Else type; };
471 
472 #endif // variant_HAVE_CONDITIONAL
473 
474 } // namespace std11
475 
477 
478 namespace std17 {
479 
480 #if variant_CPP17_OR_GREATER
481 
482 using std::is_swappable;
483 using std::is_nothrow_swappable;
484 
485 #elif variant_CPP11_OR_GREATER
486 
487 namespace detail {
488 
489 using std::swap;
490 
491 struct is_swappable
492 {
493  template< typename T, typename = decltype( swap( std::declval<T&>(), std::declval<T&>() ) ) >
494  static std::true_type test( int );
495 
496  template< typename >
497  static std::false_type test(...);
498 };
499 
500 struct is_nothrow_swappable
501 {
502  // wrap noexcept(epr) in separate function as work-around for VC140 (VS2015):
503 
504  template< typename T >
505  static constexpr bool test()
506  {
507  return noexcept( swap( std::declval<T&>(), std::declval<T&>() ) );
508  }
509 
510  template< typename T >
511  static auto test( int ) -> std::integral_constant<bool, test<T>()>{}
512 
513  template< typename >
514  static std::false_type test(...);
515 };
516 
517 } // namespace detail
518 
519 // is [nothow] swappable:
520 
521 template< typename T >
522 struct is_swappable : decltype( detail::is_swappable::test<T>(0) ){};
523 
524 template< typename T >
525 struct is_nothrow_swappable : decltype( detail::is_nothrow_swappable::test<T>(0) ){};
526 
527 #endif // variant_CPP17_OR_GREATER
528 
529 } // namespace std17
530 
531 // detail:
532 
533 namespace detail {
534 
535 // for variant_REQUIRES_T():
536 
537 /*enum*/ class enabler{};
538 
539 // typelist:
540 
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) >
557 
558 
559 // variant parameter unused type tags:
560 
561 template< class T >
562 struct TX : T
563 {
564  inline TX<T> operator+ ( ) const { return TX<T>(); }
565  inline TX<T> operator- ( ) const { return TX<T>(); }
566 
567  inline TX<T> operator! ( ) const { return TX<T>(); }
568  inline TX<T> operator~ ( ) const { return TX<T>(); }
569 
570  inline TX<T>*operator& ( ) const { return variant_nullptr; }
571 
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>(); }
574 
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>(); }
578 
579  template< class U > inline TX<T> operator<<( U const & ) const { return TX<T>(); }
580  template< class U > inline TX<T> operator>>( U const & ) const { return TX<T>(); }
581 
582  inline bool operator==( T const & ) const { return false; }
583  inline bool operator< ( T const & ) const { return false; }
584 
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>(); }
588 
589  template< class U > inline TX<T> operator&&( U const & ) const { return TX<T>(); }
590  template< class U > inline TX<T> operator||( U const & ) const { return TX<T>(); }
591 };
592 
593 struct S0{}; typedef TX<S0> T0;
594 struct S1{}; typedef TX<S1> T1;
595 struct S2{}; typedef TX<S2> T2;
596 struct S3{}; typedef TX<S3> T3;
597 struct S4{}; typedef TX<S4> T4;
598 struct S5{}; typedef TX<S5> T5;
599 struct S6{}; typedef TX<S6> T6;
600 struct S7{}; typedef TX<S7> T7;
601 struct S8{}; typedef TX<S8> T8;
602 struct S9{}; typedef TX<S9> T9;
603 struct S10{}; typedef TX<S10> T10;
604 struct S11{}; typedef TX<S11> T11;
605 struct S12{}; typedef TX<S12> T12;
606 struct S13{}; typedef TX<S13> T13;
607 struct S14{}; typedef TX<S14> T14;
608 struct S15{}; typedef TX<S15> T15;
609 
610 
611 struct nulltype{};
612 
613 template< class Head, class Tail >
614 struct typelist
615 {
616  typedef Head head;
617  typedef Tail tail;
618 };
619 
620 // typelist max element size:
621 
622 template< class List >
624 
625 template<>
627 {
628  enum V { value = 0 } ;
629  typedef void type;
630 };
631 
632 template< class Head, class Tail >
633 struct typelist_max< typelist<Head, Tail> >
634 {
635 private:
636  enum TV { tail_value = size_t( typelist_max<Tail>::value ) };
637 
638  typedef typename typelist_max<Tail>::type tail_type;
639 
640 public:
641  enum V { value = (sizeof( Head ) > tail_value) ? sizeof( Head ) : std::size_t( tail_value ) } ;
642 
643  typedef typename std11::conditional< (sizeof( Head ) > tail_value), Head, tail_type>::type type;
644 };
645 
646 #if variant_CPP11_OR_GREATER
647 
648 // typelist max alignof element type:
649 
650 template< class List >
651 struct typelist_max_alignof;
652 
653 template<>
654 struct typelist_max_alignof< nulltype >
655 {
656  enum V { value = 0 } ;
657 };
658 
659 template< class Head, class Tail >
660 struct typelist_max_alignof< typelist<Head, Tail> >
661 {
662 private:
663  enum TV { tail_value = size_t( typelist_max_alignof<Tail>::value ) };
664 
665 public:
666  enum V { value = (alignof( Head ) > tail_value) ? alignof( Head ) : std::size_t( tail_value ) };
667 };
668 
669 #endif
670 
671 // typelist size (length):
672 
673 template< class List >
675 {
676  enum V { value = 1 };
677 };
678 
679 template<> struct typelist_size< T0 > { enum V { value = 0 }; };
680 template<> struct typelist_size< T1 > { enum V { value = 0 }; };
681 template<> struct typelist_size< T2 > { enum V { value = 0 }; };
682 template<> struct typelist_size< T3 > { enum V { value = 0 }; };
683 template<> struct typelist_size< T4 > { enum V { value = 0 }; };
684 template<> struct typelist_size< T5 > { enum V { value = 0 }; };
685 template<> struct typelist_size< T6 > { enum V { value = 0 }; };
686 template<> struct typelist_size< T7 > { enum V { value = 0 }; };
687 template<> struct typelist_size< T8 > { enum V { value = 0 }; };
688 template<> struct typelist_size< T9 > { enum V { value = 0 }; };
689 template<> struct typelist_size< T10 > { enum V { value = 0 }; };
690 template<> struct typelist_size< T11 > { enum V { value = 0 }; };
691 template<> struct typelist_size< T12 > { enum V { value = 0 }; };
692 template<> struct typelist_size< T13 > { enum V { value = 0 }; };
693 template<> struct typelist_size< T14 > { enum V { value = 0 }; };
694 template<> struct typelist_size< T15 > { enum V { value = 0 }; };
695 
696 
697 template<> struct typelist_size< nulltype > { enum V { value = 0 } ; };
698 
699 template< class Head, class Tail >
700 struct typelist_size< typelist<Head, Tail> >
701 {
703 };
704 
705 // typelist index of type:
706 
707 template< class List, class T >
709 
710 template< class T >
712 {
713  enum V { value = -1 };
714 };
715 
716 template< class Tail, class T >
717 struct typelist_index_of< typelist<T, Tail>, T >
718 {
719  enum V { value = 0 };
720 };
721 
722 template< class Head, class Tail, class T >
723 struct typelist_index_of< typelist<Head, Tail>, T >
724 {
725 private:
726  enum TV { nextVal = typelist_index_of<Tail, T>::value };
727 
728 public:
729  enum V { value = nextVal == -1 ? -1 : 1 + nextVal } ;
730 };
731 
732 // typelist type at index:
733 
734 template< class List, std::size_t i>
736 
737 template< class Head, class Tail >
738 struct typelist_type_at< typelist<Head, Tail>, 0 >
739 {
740  typedef Head type;
741 };
742 
743 template< class Head, class Tail, std::size_t i >
744 struct typelist_type_at< typelist<Head, Tail>, i >
745 {
746  typedef typename typelist_type_at<Tail, i - 1>::type type;
747 };
748 
749 #if variant_CONFIG_MAX_ALIGN_HACK
750 
751 // Max align, use most restricted type for alignment:
752 
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
756 
757 #define variant_ALIGN_TYPE( type ) \
758  type variant_UNIQUE( _t ); struct_t< type > variant_UNIQUE( _st )
759 
760 template< class T >
761 struct struct_t { T _; };
762 
763 union max_align_t
764 {
765  variant_ALIGN_TYPE( char );
766  variant_ALIGN_TYPE( short int );
767  variant_ALIGN_TYPE( int );
768  variant_ALIGN_TYPE( long int );
769  variant_ALIGN_TYPE( float );
770  variant_ALIGN_TYPE( double );
771  variant_ALIGN_TYPE( long double );
772  variant_ALIGN_TYPE( char * );
773  variant_ALIGN_TYPE( short int * );
774  variant_ALIGN_TYPE( int * );
775  variant_ALIGN_TYPE( long int * );
776  variant_ALIGN_TYPE( float * );
777  variant_ALIGN_TYPE( double * );
778  variant_ALIGN_TYPE( long double * );
779  variant_ALIGN_TYPE( void * );
780 
781 #ifdef HAVE_LONG_LONG
782  variant_ALIGN_TYPE( long long );
783 #endif
784 
785  struct Unknown;
786 
787  Unknown ( * variant_UNIQUE(_) )( Unknown );
788  Unknown * Unknown::* variant_UNIQUE(_);
789  Unknown ( Unknown::* variant_UNIQUE(_) )( Unknown );
790 
791  struct_t< Unknown ( * )( Unknown) > variant_UNIQUE(_);
792  struct_t< Unknown * Unknown::* > variant_UNIQUE(_);
793  struct_t< Unknown ( Unknown::* )(Unknown) > variant_UNIQUE(_);
794 };
795 
796 #undef variant_UNIQUE
797 #undef variant_UNIQUE2
798 #undef variant_UNIQUE3
799 
800 #undef variant_ALIGN_TYPE
801 
802 #elif defined( variant_CONFIG_ALIGN_AS ) // variant_CONFIG_MAX_ALIGN_HACK
803 
804 // Use user-specified type for alignment:
805 
806 #define variant_ALIGN_AS( unused ) \
807  variant_CONFIG_ALIGN_AS
808 
809 #else // variant_CONFIG_MAX_ALIGN_HACK
810 
811 // Determine POD type to use for alignment:
812 
813 #define variant_ALIGN_AS( to_align ) \
814  typename detail::type_of_size< detail::alignment_types, detail::alignment_of< to_align >::value >::type
815 
816 template< typename T >
818 
819 template< typename T >
821 {
822  char c;
823  T t;
825 };
826 
827 template< size_t A, size_t S >
829 {
830  enum V { value = A < S ? A : S };
831 };
832 
833 template< typename T >
834 struct alignment_of
835 {
837  sizeof( alignment_of_hack<T> ) - sizeof(T), sizeof(T) >::value };
838 };
839 
840 template< typename List, size_t N >
842 {
843  typedef typename std11::conditional<
844  N == sizeof( typename List::head ),
845  typename List::head,
847 };
848 
849 template< size_t N >
850 struct type_of_size< nulltype, N >
851 {
853 };
854 
855 template< typename T>
856 struct struct_t { T _; };
857 
858 #define variant_ALIGN_TYPE( type ) \
859  typelist< type , typelist< struct_t< type >
860 
861 struct Unknown;
862 
863 typedef
870  variant_ALIGN_TYPE( long double ),
871 
873  variant_ALIGN_TYPE( short * ),
876  variant_ALIGN_TYPE( float * ),
877  variant_ALIGN_TYPE( double * ),
878  variant_ALIGN_TYPE( long double * ),
879 
880  variant_ALIGN_TYPE( Unknown ( * )( Unknown ) ),
881  variant_ALIGN_TYPE( Unknown * Unknown::* ),
882  variant_ALIGN_TYPE( Unknown ( Unknown::* )( Unknown ) ),
883 
884  nulltype
885  > > > > > > > > > > > > > >
886  > > > > > > > > > > > > > >
887  > > > > > >
889 
890 #undef variant_ALIGN_TYPE
891 
892 #endif // variant_CONFIG_MAX_ALIGN_HACK
893 
894 #if variant_CPP11_OR_GREATER
895 
896 template< typename T>
897 inline std::size_t hash( T const & v )
898 {
899  return std::hash<T>()( v );
900 }
901 
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; }
918 
919 
920 #endif // variant_CPP11_OR_GREATER
921 
922 
923 
924 
925 
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 >
927 struct helper
928 {
929  typedef signed char type_index_t;
930  typedef variant_TL16( T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) variant_types;
931 
932  template< class U >
933  static U * as( void * data )
934  {
935  return reinterpret_cast<U*>( data );
936  }
937 
938  template< class U >
939  static U const * as( void const * data )
940  {
941  return reinterpret_cast<const U*>( data );
942  }
943 
944  static type_index_t to_index_t( std::size_t index )
945  {
946  return static_cast<type_index_t>( index );
947  }
948 
949  static void destroy( type_index_t index, void * data )
950  {
951  switch ( index )
952  {
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;
969 
970  }
971  }
972 
973 #if variant_CPP11_OR_GREATER
974  template< class T, class... Args >
975  static type_index_t construct_t( void * data, Args&&... args )
976  {
977  new( data ) T( std::forward<Args>(args)... );
978 
980  }
981 
982  template< std::size_t K, class... Args >
983  static type_index_t construct_i( void * data, Args&&... args )
984  {
986 
987  construct_t< type >( data, std::forward<Args>(args)... );
988 
989  return to_index_t( K );
990  }
991 
992  static type_index_t move_construct( type_index_t const from_index, void * from_value, void * to_value )
993  {
994  switch ( from_index )
995  {
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;
1012 
1013  }
1014  return from_index;
1015  }
1016 
1017  static type_index_t move_assign( type_index_t const from_index, void * from_value, void * to_value )
1018  {
1019  switch ( from_index )
1020  {
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;
1037 
1038  }
1039  return from_index;
1040  }
1041 #endif
1042 
1043  static type_index_t copy_construct( type_index_t const from_index, const void * from_value, void * to_value )
1044  {
1045  switch ( from_index )
1046  {
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;
1063 
1064  }
1065  return from_index;
1066  }
1067 
1068  static type_index_t copy_assign( type_index_t const from_index, const void * from_value, void * to_value )
1069  {
1070  switch ( from_index )
1071  {
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;
1088 
1089  }
1090  return from_index;
1091  }
1092 };
1093 
1094 } // namespace detail
1095 
1096 //
1097 // Variant:
1098 //
1099 
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 >
1101 class variant;
1102 
1103 // 19.7.8 Class monostate
1104 
1105 class monostate{};
1106 
1107 // 19.7.9 monostate relational operators
1108 
1115 
1116 // 19.7.4 variant helper classes
1117 
1118 // obtain the size of the variant's list of alternatives at compile time
1119 
1120 template< class T >
1121 struct variant_size; /* undefined */
1122 
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> >
1125 {
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 };
1127 };
1128 
1129 #if variant_CPP14_OR_GREATER
1130 template< class T >
1131 constexpr std::size_t variant_size_v = variant_size<T>::value;
1132 #endif
1133 
1134 #if ! variant_CONFIG_OMIT_VARIANT_SIZE_V_MACRO
1135 # define variant_size_V(T) nonstd::variant_size<T>::value
1136 #endif
1137 
1138 // obtain the type of the alternative specified by its index, at compile time:
1139 
1140 template< std::size_t K, class T >
1141 struct variant_alternative; /* undefined */
1142 
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> >
1145 {
1147 };
1148 
1149 #if variant_CPP11_OR_GREATER
1150 template< std::size_t K, class T >
1151 using variant_alternative_t = typename variant_alternative<K, T>::type;
1152 #endif
1153 
1154 #if ! variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO
1155 # define variant_alternative_T(K,T) typename nonstd::variant_alternative<K,T >::type
1156 #endif
1157 
1158 // NTS:implement specializes the std::uses_allocator type trait
1159 // std::uses_allocator<nonstd::variant>
1160 
1161 // index of the variant in the invalid state (constant)
1162 
1163 #if variant_CPP11_OR_GREATER
1164 variant_constexpr std::size_t variant_npos = static_cast<std::size_t>( -1 );
1165 #else
1166 static const std::size_t variant_npos = static_cast<std::size_t>( -1 );
1167 #endif
1168 
1169 #if ! variant_CONFIG_NO_EXCEPTIONS
1170 
1171 // 19.7.11 Class bad_variant_access
1172 
1173 class bad_variant_access : public std::exception
1174 {
1175 public:
1176 #if variant_CPP11_OR_GREATER
1177  virtual const char* what() const variant_noexcept variant_override
1178 #else
1179  virtual const char* what() const throw()
1180 #endif
1181  {
1182  return "bad variant access";
1183  }
1184 };
1185 
1186 #endif // variant_CONFIG_NO_EXCEPTIONS
1187 
1188 // 19.7.3 Class template variant
1189 
1190 template<
1191  class T0,
1192  class T1 = detail::T1,
1193  class T2 = detail::T2,
1194  class T3 = detail::T3,
1195  class T4 = detail::T4,
1196  class T5 = detail::T5,
1197  class T6 = detail::T6,
1198  class T7 = detail::T7,
1199  class T8 = detail::T8,
1200  class T9 = detail::T9,
1201  class T10 = detail::T10,
1202  class T11 = detail::T11,
1203  class T12 = detail::T12,
1204  class T13 = detail::T13,
1205  class T14 = detail::T14,
1206  class T15 = detail::T15
1207  >
1208 class variant
1209 {
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;
1212 
1213 public:
1214  // 19.7.3.1 Constructors
1215 
1216  variant() : type_index( 0 ) { new( ptr() ) T0(); }
1217 
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 ); }
1234 
1235 
1236 #if variant_CPP11_OR_GREATER
1237  variant( T0 && t0 ) : type_index( 0 ) { new( ptr() ) T0( std::move(t0) ); }
1238  variant( T1 && t1 ) : type_index( 1 ) { new( ptr() ) T1( std::move(t1) ); }
1239  variant( T2 && t2 ) : type_index( 2 ) { new( ptr() ) T2( std::move(t2) ); }
1240  variant( T3 && t3 ) : type_index( 3 ) { new( ptr() ) T3( std::move(t3) ); }
1241  variant( T4 && t4 ) : type_index( 4 ) { new( ptr() ) T4( std::move(t4) ); }
1242  variant( T5 && t5 ) : type_index( 5 ) { new( ptr() ) T5( std::move(t5) ); }
1243  variant( T6 && t6 ) : type_index( 6 ) { new( ptr() ) T6( std::move(t6) ); }
1244  variant( T7 && t7 ) : type_index( 7 ) { new( ptr() ) T7( std::move(t7) ); }
1245  variant( T8 && t8 ) : type_index( 8 ) { new( ptr() ) T8( std::move(t8) ); }
1246  variant( T9 && t9 ) : type_index( 9 ) { new( ptr() ) T9( std::move(t9) ); }
1247  variant( T10 && t10 ) : type_index( 10 ) { new( ptr() ) T10( std::move(t10) ); }
1248  variant( T11 && t11 ) : type_index( 11 ) { new( ptr() ) T11( std::move(t11) ); }
1249  variant( T12 && t12 ) : type_index( 12 ) { new( ptr() ) T12( std::move(t12) ); }
1250  variant( T13 && t13 ) : type_index( 13 ) { new( ptr() ) T13( std::move(t13) ); }
1251  variant( T14 && t14 ) : type_index( 14 ) { new( ptr() ) T14( std::move(t14) ); }
1252  variant( T15 && t15 ) : type_index( 15 ) { new( ptr() ) T15( std::move(t15) ); }
1253 
1254 #endif
1255 
1256  variant(variant const & other)
1257  : type_index( other.type_index )
1258  {
1259  (void) helper_type::copy_construct( other.type_index, other.ptr(), ptr() );
1260  }
1261 
1262 #if variant_CPP11_OR_GREATER
1263 
1264  variant( variant && other ) noexcept(
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 )
1282  {
1283  (void) helper_type::move_construct( other.type_index, other.ptr(), ptr() );
1284  }
1285 
1286  template< std::size_t K >
1287  using type_at_t = typename detail::typelist_type_at< variant_types, K >::type;
1288 
1289  template< class T, class... Args
1290  variant_REQUIRES_T( std::is_constructible< T, Args...>::value )
1291  >
1292  explicit variant( nonstd_lite_in_place_type_t(T), Args&&... args)
1293  {
1294  type_index = variant_npos_internal();
1295  type_index = helper_type::template construct_t<T>( ptr(), std::forward<Args>(args)... );
1296  }
1297 
1298  template< class T, class U, class... Args
1299  variant_REQUIRES_T( std::is_constructible< T, std::initializer_list<U>&, Args...>::value )
1300  >
1301  explicit variant( nonstd_lite_in_place_type_t(T), std::initializer_list<U> il, Args&&... args )
1302  {
1303  type_index = variant_npos_internal();
1304  type_index = helper_type::template construct_t<T>( ptr(), il, std::forward<Args>(args)... );
1305  }
1306 
1307  template< std::size_t K, class... Args
1308  variant_REQUIRES_T( std::is_constructible< type_at_t<K>, Args...>::value )
1309  >
1310  explicit variant( nonstd_lite_in_place_index_t(K), Args&&... args )
1311  {
1312  type_index = variant_npos_internal();
1313  type_index = helper_type::template construct_i<K>( ptr(), std::forward<Args>(args)... );
1314  }
1315 
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 )
1318  >
1319  explicit variant( nonstd_lite_in_place_index_t(K), std::initializer_list<U> il, Args&&... args )
1320  {
1321  type_index = variant_npos_internal();
1322  type_index = helper_type::template construct_i<K>( ptr(), il, std::forward<Args>(args)... );
1323  }
1324 
1325 #endif // variant_CPP11_OR_GREATER
1326 
1327  // 19.7.3.2 Destructor
1328 
1330  {
1331  if ( ! valueless_by_exception() )
1332  {
1333  helper_type::destroy( type_index, ptr() );
1334  }
1335  }
1336 
1337  // 19.7.3.3 Assignment
1338 
1339  variant & operator=( variant const & other )
1340  {
1341  return copy_assign( other );
1342  }
1343 
1344 #if variant_CPP11_OR_GREATER
1345 
1346  variant & operator=( variant && other ) noexcept(
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)
1363  {
1364  return move_assign( std::move( other ) );
1365  }
1366 
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 ) ); }
1383 
1384 
1385 #endif
1386 
1387  variant & operator=( T0 const & t0 ) { return assign_value<0>( t0 ); }
1388  variant & operator=( T1 const & t1 ) { return assign_value<1>( t1 ); }
1389  variant & operator=( T2 const & t2 ) { return assign_value<2>( t2 ); }
1390  variant & operator=( T3 const & t3 ) { return assign_value<3>( t3 ); }
1391  variant & operator=( T4 const & t4 ) { return assign_value<4>( t4 ); }
1392  variant & operator=( T5 const & t5 ) { return assign_value<5>( t5 ); }
1393  variant & operator=( T6 const & t6 ) { return assign_value<6>( t6 ); }
1394  variant & operator=( T7 const & t7 ) { return assign_value<7>( t7 ); }
1395  variant & operator=( T8 const & t8 ) { return assign_value<8>( t8 ); }
1396  variant & operator=( T9 const & t9 ) { return assign_value<9>( t9 ); }
1397  variant & operator=( T10 const & t10 ) { return assign_value<10>( t10 ); }
1398  variant & operator=( T11 const & t11 ) { return assign_value<11>( t11 ); }
1399  variant & operator=( T12 const & t12 ) { return assign_value<12>( t12 ); }
1400  variant & operator=( T13 const & t13 ) { return assign_value<13>( t13 ); }
1401  variant & operator=( T14 const & t14 ) { return assign_value<14>( t14 ); }
1402  variant & operator=( T15 const & t15 ) { return assign_value<15>( t15 ); }
1403 
1404 
1405  std::size_t index() const
1406  {
1407  return variant_npos_internal() == type_index ? variant_npos : static_cast<std::size_t>( type_index );
1408  }
1409 
1410  // 19.7.3.4 Modifiers
1411 
1412 #if variant_CPP11_OR_GREATER
1413  template< class T, class... Args
1414  variant_REQUIRES_T( std::is_constructible< T, Args...>::value )
1415  >
1416  T& emplace( Args&&... args )
1417  {
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)... );
1421 
1422  return *as<T>();
1423  }
1424 
1425  template< class T, class U, class... Args
1426  variant_REQUIRES_T( std::is_constructible< T, std::initializer_list<U>&, Args...>::value )
1427  >
1428  T& emplace( std::initializer_list<U> il, Args&&... args )
1429  {
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)... );
1433 
1434  return *as<T>();
1435  }
1436 
1437  template< size_t K, class... Args
1438  variant_REQUIRES_T( std::is_constructible< type_at_t<K>, Args...>::value )
1439  >
1440  variant_alternative_t<K, variant> & emplace( Args&&... args )
1441  {
1442  return this->template emplace< type_at_t<K> >( std::forward<Args>(args)... );
1443  }
1444 
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 )
1447  >
1448  variant_alternative_t<K, variant> & emplace( std::initializer_list<U> il, Args&&... args )
1449  {
1450  return this->template emplace< type_at_t<K> >( il, std::forward<Args>(args)... );
1451  }
1452 
1453 #endif // variant_CPP11_OR_GREATER
1454 
1455  // 19.7.3.5 Value status
1456 
1458  {
1459  return type_index == variant_npos_internal();
1460  }
1461 
1462  // 19.7.3.6 Swap
1463 
1464  void swap( variant & other )
1465 #if variant_CPP11_OR_GREATER
1466  noexcept(
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
1483 
1484  )
1485 #endif
1486  {
1488  {
1489  // no effect
1490  }
1491  else if ( type_index == other.type_index )
1492  {
1493  this->swap_value( type_index, other );
1494  }
1495  else
1496  {
1497 #if variant_CPP11_OR_GREATER
1498  variant tmp( std::move( *this ) );
1499  *this = std::move( other );
1500  other = std::move( tmp );
1501 #else
1502  variant tmp( *this );
1503  *this = other;
1504  other = tmp;
1505 #endif
1506  }
1507  }
1508 
1509  //
1510  // non-standard:
1511  //
1512 
1513  template< class T >
1515  {
1516  return to_size_t( detail::typelist_index_of<variant_types, typename std11::remove_cv<T>::type >::value );
1517  }
1518 
1519  template< class T >
1520  T & get()
1521  {
1522  const std::size_t i = index_of<T>();
1523 
1524 #if variant_CONFIG_NO_EXCEPTIONS
1525  assert( i == index() );
1526 #else
1527  if ( i != index() )
1528  {
1529  throw bad_variant_access();
1530  }
1531 #endif
1532  return *as<T>();
1533  }
1534 
1535  template< class T >
1536  T const & get() const
1537  {
1538  const std::size_t i = index_of<T>();
1539 
1540 #if variant_CONFIG_NO_EXCEPTIONS
1541  assert( i == index() );
1542 #else
1543  if ( i != index() )
1544  {
1545  throw bad_variant_access();
1546  }
1547 #endif
1548  return *as<const T>();
1549  }
1550 
1551  template< std::size_t K >
1554  {
1555  return this->template get< typename detail::typelist_type_at< variant_types, K >::type >();
1556  }
1557 
1558  template< std::size_t K >
1560  get() const
1561  {
1562  return this->template get< typename detail::typelist_type_at< variant_types, K >::type >();
1563  }
1564 
1565 private:
1566  typedef typename helper_type::type_index_t type_index_t;
1567 
1568  void * ptr() variant_noexcept
1569  {
1570  return &data;
1571  }
1572 
1573  void const * ptr() const variant_noexcept
1574  {
1575  return &data;
1576  }
1577 
1578  template< class U >
1579  U * as()
1580  {
1581  return reinterpret_cast<U*>( ptr() );
1582  }
1583 
1584  template< class U >
1585  U const * as() const
1586  {
1587  return reinterpret_cast<U const *>( ptr() );
1588  }
1589 
1590  template< class U >
1591  static variant_constexpr std::size_t to_size_t( U index )
1592  {
1593  return static_cast<std::size_t>( index );
1594  }
1595 
1596  variant_constexpr type_index_t variant_npos_internal() const variant_noexcept
1597  {
1598  return static_cast<type_index_t>( -1 );
1599  }
1600 
1601  variant & copy_assign( variant const & other )
1602  {
1603  if ( valueless_by_exception() && other.valueless_by_exception() )
1604  {
1605  // no effect
1606  }
1607  else if ( ! valueless_by_exception() && other.valueless_by_exception() )
1608  {
1609  helper_type::destroy( type_index, ptr() );
1610  type_index = variant_npos_internal();
1611  }
1612  else if ( index() == other.index() )
1613  {
1614  type_index = helper_type::copy_assign( other.type_index, other.ptr(), ptr() );
1615  }
1616  else
1617  {
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() );
1621  }
1622  return *this;
1623  }
1624 
1625 #if variant_CPP11_OR_GREATER
1626 
1627  variant & move_assign( variant && other )
1628  {
1629  if ( valueless_by_exception() && other.valueless_by_exception() )
1630  {
1631  // no effect
1632  }
1633  else if ( ! valueless_by_exception() && other.valueless_by_exception() )
1634  {
1635  helper_type::destroy( type_index, ptr() );
1636  type_index = variant_npos_internal();
1637  }
1638  else if ( index() == other.index() )
1639  {
1640  type_index = helper_type::move_assign( other.type_index, other.ptr(), ptr() );
1641  }
1642  else
1643  {
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() );
1647  }
1648  return *this;
1649  }
1650 
1651  template< std::size_t K, class T >
1652  variant & assign_value( T && value )
1653  {
1654  if( index() == K )
1655  {
1656  *as<T>() = std::forward<T>( value );
1657  }
1658  else
1659  {
1660  helper_type::destroy( type_index, ptr() );
1661  type_index = variant_npos_internal();
1662  new( ptr() ) T( std::forward<T>( value ) );
1663  type_index = K;
1664  }
1665  return *this;
1666  }
1667 
1668 #endif // variant_CPP11_OR_GREATER
1669 
1670  template< std::size_t K, class T >
1671  variant & assign_value( T const & value )
1672  {
1673  if( index() == K )
1674  {
1675  *as<T>() = value;
1676  }
1677  else
1678  {
1679  helper_type::destroy( type_index, ptr() );
1680  type_index = variant_npos_internal();
1681  new( ptr() ) T( value );
1682  type_index = K;
1683  }
1684  return *this;
1685  }
1686 
1687  void swap_value( type_index_t index, variant & other )
1688  {
1689  using std::swap;
1690  switch( index )
1691  {
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;
1708 
1709  }
1710  }
1711 
1712 private:
1713  enum { data_size = detail::typelist_max< variant_types >::value };
1714 
1715 #if variant_CPP11_OR_GREATER
1716 
1717  enum { data_align = detail::typelist_max_alignof< variant_types >::value };
1718 
1719  using aligned_storage_t = typename std::aligned_storage< data_size, data_align >::type;
1720  aligned_storage_t data;
1721 
1722 #elif variant_CONFIG_MAX_ALIGN_HACK
1723 
1724  typedef union { unsigned char data[ data_size ]; } aligned_storage_t;
1725 
1726  detail::max_align_t hack;
1727  aligned_storage_t data;
1728 
1729 #else
1730  typedef typename detail::typelist_max< variant_types >::type max_type;
1731 
1732  typedef variant_ALIGN_AS( max_type ) align_as_type;
1733 
1734  typedef union { align_as_type data[ 1 + ( data_size - 1 ) / sizeof(align_as_type) ]; } aligned_storage_t;
1735  aligned_storage_t data;
1736 
1737 // # undef variant_ALIGN_AS
1738 
1739 #endif // variant_CONFIG_MAX_ALIGN_HACK
1740 
1741  type_index_t type_index;
1742 };
1743 
1744 // 19.7.5 Value access
1745 
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 >
1748 {
1750 }
1751 
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 >
1754 {
1755  return v.template get<R>();
1756 }
1757 
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 >
1760 {
1761  return v.template get<R>();
1762 }
1763 
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 >
1767 {
1768 #if variant_CONFIG_NO_EXCEPTIONS
1769  assert( K == v.index() );
1770 #else
1771  if ( K != v.index() )
1772  {
1773  throw bad_variant_access();
1774  }
1775 #endif
1776  return v.template get<K>();
1777 }
1778 
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 >
1782 {
1783 #if variant_CONFIG_NO_EXCEPTIONS
1784  assert( K == v.index() );
1785 #else
1786  if ( K != v.index() )
1787  {
1788  throw bad_variant_access();
1789  }
1790 #endif
1791  return v.template get<K>();
1792 }
1793 
1794 #if variant_CPP11_OR_GREATER
1795 
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 >
1798 {
1799  return std::move(v.template get<R>());
1800 }
1801 
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) )
1804 {
1805  return std::move(v.template get<R>());
1806 }
1807 
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) )
1811 {
1812 #if variant_CONFIG_NO_EXCEPTIONS
1813  assert( K == v.index() );
1814 #else
1815  if ( K != v.index() )
1816  {
1817  throw bad_variant_access();
1818  }
1819 #endif
1820  return std::move(v.template get<K>());
1821 }
1822 
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) )
1826 {
1827 #if variant_CONFIG_NO_EXCEPTIONS
1828  assert( K == v.index() );
1829 #else
1830  if ( K != v.index() )
1831  {
1832  throw bad_variant_access();
1833  }
1834 #endif
1835  return std::move(v.template get<K>());
1836 }
1837 
1838 #endif // variant_CPP11_OR_GREATER
1839 
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 >
1841 inline typename std11::add_pointer<T>::type
1843 {
1845 }
1846 
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 >
1848 inline typename std11::add_pointer<const T>::type
1850 {
1852 }
1853 
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 >
1857 {
1858  return ( pv->index() == K ) ? &get<K>( *pv ) : variant_nullptr;
1859 }
1860 
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 >
1864 {
1865  return ( pv->index() == K ) ? &get<K>( *pv ) : variant_nullptr;
1866 }
1867 
1868 // 19.7.10 Specialized algorithms
1869 
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
1872  variant_REQUIRES_T(
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
1889  )
1890 #endif
1891 >
1892 inline void swap(
1895 #if variant_CPP11_OR_GREATER
1896  noexcept( noexcept( a.swap( b ) ) )
1897 #endif
1898 {
1899  a.swap( b );
1900 }
1901 
1902 // 19.7.7 Visitation
1903 
1904 // Variant 'visitor' implementation
1905 
1906 namespace detail
1907 {
1908 
1909 template< typename R, typename VT >
1911 {
1912  template< typename Visitor, typename T >
1913  static R apply(Visitor const& v, T const& arg)
1914  {
1915  return v(arg);
1916  }
1917 };
1918 
1919 template< typename R, typename VT >
1920 struct VisitorApplicatorImpl<R, TX<VT> >
1921 {
1922  template< typename Visitor, typename T >
1923  static R apply(Visitor const&, T)
1924  {
1925  return R();
1926  }
1927 };
1928 
1929 template<typename R>
1931 
1932 template< typename R, typename Visitor, typename V1 >
1934 
1935 #if variant_CPP11_OR_GREATER
1936 template< size_t NumVars, typename R, typename Visitor, typename ... T >
1937 #else
1938 template< size_t NumVars, typename R, typename Visitor, typename T1, typename T2 = S0, typename T3 = S0, typename T4 = S0, typename T5 = S0 >
1939 #endif
1941 
1942 template< typename R, typename Visitor, typename T2 >
1943 struct TypedVisitorUnwrapper<2, R, Visitor, T2>
1944 {
1945  const Visitor& visitor;
1946  T2 const& val2;
1947 
1948  TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_)
1949  : visitor(visitor_)
1950  , val2(val2_)
1951 
1952  {
1953  }
1954 
1955  template<typename T>
1956  R operator()(const T& val1) const
1957  {
1958  return visitor(val1, val2);
1959  }
1960 };
1961 
1962 template< typename R, typename Visitor, typename T2, typename T3 >
1963 struct TypedVisitorUnwrapper<3, R, Visitor, T2, T3>
1964 {
1965  const Visitor& visitor;
1966  T2 const& val2;
1967  T3 const& val3;
1968 
1969  TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_, T3 const& val3_)
1970  : visitor(visitor_)
1971  , val2(val2_)
1972  , val3(val3_)
1973 
1974  {
1975  }
1976 
1977  template<typename T>
1978  R operator()(const T& val1) const
1979  {
1980  return visitor(val1, val2, val3);
1981  }
1982 };
1983 
1984 template< typename R, typename Visitor, typename T2, typename T3, typename T4 >
1985 struct TypedVisitorUnwrapper<4, R, Visitor, T2, T3, T4>
1986 {
1987  const Visitor& visitor;
1988  T2 const& val2;
1989  T3 const& val3;
1990  T4 const& val4;
1991 
1992  TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_, T3 const& val3_, T4 const& val4_)
1993  : visitor(visitor_)
1994  , val2(val2_)
1995  , val3(val3_)
1996  , val4(val4_)
1997 
1998  {
1999  }
2000 
2001  template<typename T>
2002  R operator()(const T& val1) const
2003  {
2004  return visitor(val1, val2, val3, val4);
2005  }
2006 };
2007 
2008 template< typename R, typename Visitor, typename T2, typename T3, typename T4, typename T5 >
2009 struct TypedVisitorUnwrapper<5, R, Visitor, T2, T3, T4, T5>
2010 {
2011  const Visitor& visitor;
2012  T2 const& val2;
2013  T3 const& val3;
2014  T4 const& val4;
2015  T5 const& val5;
2016 
2017  TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_, T3 const& val3_, T4 const& val4_, T5 const& val5_)
2018  : visitor(visitor_)
2019  , val2(val2_)
2020  , val3(val3_)
2021  , val4(val4_)
2022  , val5(val5_)
2023 
2024  {
2025  }
2026 
2027  template<typename T>
2028  R operator()(const T& val1) const
2029  {
2030  return visitor(val1, val2, val3, val4, val5);
2031  }
2032 };
2033 
2034 
2035 
2036 template<typename R, typename Visitor, typename V2>
2037 struct VisitorUnwrapper
2038 {
2039  const Visitor& visitor;
2040  const V2& r;
2041 
2042  VisitorUnwrapper(const Visitor& visitor_, const V2& r_)
2043  : visitor(visitor_)
2044  , r(r_)
2045  {
2046  }
2047 
2048 
2049  template< typename T1 >
2050  R operator()(T1 const& val1) const
2051  {
2052  typedef TypedVisitorUnwrapper<2, R, Visitor, T1> visitor_type;
2053  return VisitorApplicator<R>::apply(visitor_type(visitor, val1), r);
2054  }
2055 
2056  template< typename T1, typename T2 >
2057  R operator()(T1 const& val1, T2 const& val2) const
2058  {
2059  typedef TypedVisitorUnwrapper<3, R, Visitor, T1, T2> visitor_type;
2060  return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2), r);
2061  }
2062 
2063  template< typename T1, typename T2, typename T3 >
2064  R operator()(T1 const& val1, T2 const& val2, T3 const& val3) const
2065  {
2067  return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2, val3), r);
2068  }
2069 
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
2072  {
2074  return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2, val3, val4), r);
2075  }
2076 
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
2079  {
2081  return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2, val3, val4, val5), r);
2082  }
2083 
2084 };
2085 
2086 
2087 template<typename R>
2088 struct VisitorApplicator
2089 {
2090  template<typename Visitor, typename V1>
2091  static R apply(const Visitor& v, const V1& arg)
2092  {
2093  switch( arg.index() )
2094  {
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);
2111 
2112  default: return R();
2113  }
2114  }
2115 
2116  template<size_t Idx, typename Visitor, typename V1>
2117  static R apply_visitor(const Visitor& v, const V1& arg)
2118  {
2119 
2120 #if variant_CPP11_OR_GREATER
2121  typedef typename variant_alternative<Idx, typename std::decay<V1>::type>::type value_type;
2122 #else
2123  typedef typename variant_alternative<Idx, V1>::type value_type;
2124 #endif
2125  return VisitorApplicatorImpl<R, value_type>::apply(v, get<Idx>(arg));
2126  }
2127 
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)
2131  {
2132  typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
2133  Unwrapper unwrapper(v, arg1);
2134  return apply(unwrapper, arg2, args ...);
2135  }
2136 #else
2137 
2138  template< typename Visitor, typename V1, typename V2 >
2139  static R apply(const Visitor& v, V1 const& arg1, V2 const& arg2)
2140  {
2141  typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
2142  Unwrapper unwrapper(v, arg1);
2143  return apply(unwrapper, arg2);
2144  }
2145 
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)
2148  {
2149  typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
2150  Unwrapper unwrapper(v, arg1);
2151  return apply(unwrapper, arg2, arg3);
2152  }
2153 
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)
2156  {
2157  typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
2158  Unwrapper unwrapper(v, arg1);
2159  return apply(unwrapper, arg2, arg3, arg4);
2160  }
2161 
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)
2164  {
2165  typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
2166  Unwrapper unwrapper(v, arg1);
2167  return apply(unwrapper, arg2, arg3, arg4, arg5);
2168  }
2169 
2170 #endif
2171 };
2172 
2173 #if variant_CPP11_OR_GREATER
2174 template< size_t NumVars, typename Visitor, typename ... V >
2175 struct VisitorImpl
2176 {
2177  typedef decltype(std::declval<Visitor>()(get<0>(static_cast<const V&>(std::declval<V>()))...)) result_type;
2178  typedef VisitorApplicator<result_type> applicator_type;
2179 };
2180 #endif
2181 } // detail
2182 
2183 #if variant_CPP11_OR_GREATER
2184 // No perfect forwarding here in order to simplify code
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
2187 {
2188  typedef detail::VisitorImpl<sizeof ... (V), Visitor, V... > impl_type;
2189  return impl_type::applicator_type::apply(v, vars...);
2190 }
2191 #else
2192 
2193 template< typename R, typename Visitor, typename V1 >
2194 inline R visit(const Visitor& v, V1 const& arg1)
2195 {
2196  return detail::VisitorApplicator<R>::apply(v, arg1);
2197 }
2198 
2199 template< typename R, typename Visitor, typename V1, typename V2 >
2200 inline R visit(const Visitor& v, V1 const& arg1, V2 const& arg2)
2201 {
2202  return detail::VisitorApplicator<R>::apply(v, arg1, arg2);
2203 }
2204 
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)
2207 {
2208  return detail::VisitorApplicator<R>::apply(v, arg1, arg2, arg3);
2209 }
2210 
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)
2213 {
2214  return detail::VisitorApplicator<R>::apply(v, arg1, arg2, arg3, arg4);
2215 }
2216 
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)
2219 {
2220  return detail::VisitorApplicator<R>::apply(v, arg1, arg2, arg3, arg4, arg5);
2221 }
2222 
2223 #endif
2224 
2225 // 19.7.6 Relational operators
2226 
2227 namespace detail {
2228 
2229 template< class Variant >
2231 {
2232  static inline bool equal( Variant const & v, Variant const & w )
2233  {
2234  switch( v.index() )
2235  {
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 );
2252 
2253  default: return false;
2254  }
2255  }
2256 
2257  static inline bool less_than( Variant const & v, Variant const & w )
2258  {
2259  switch( v.index() )
2260  {
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 );
2277 
2278  default: return false;
2279  }
2280  }
2281 };
2282 
2283 } //namespace detail
2284 
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 >
2286 inline bool operator==(
2289 {
2290  if ( v.index() != w.index() ) return false;
2291  else if ( v.valueless_by_exception() ) return true;
2293 }
2294 
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 >
2296 inline bool operator!=(
2299 {
2300  return ! ( v == w );
2301 }
2302 
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 >
2304 inline bool operator<(
2307 {
2308  if ( w.valueless_by_exception() ) return false;
2309  else if ( v.valueless_by_exception() ) return true;
2310  else if ( v.index() < w.index() ) return true;
2311  else if ( v.index() > w.index() ) return false;
2313 }
2314 
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 >
2316 inline bool operator>(
2319 {
2320  return w < v;
2321 }
2322 
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 >
2324 inline bool operator<=(
2327 {
2328  return ! ( v > w );
2329 }
2330 
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 >
2332 inline bool operator>=(
2335 {
2336  return ! ( v < w );
2337 }
2338 
2339 } // namespace variants
2340 
2341 using namespace variants;
2342 
2343 } // namespace nonstd
2344 
2345 #if variant_CPP11_OR_GREATER
2346 
2347 // 19.7.12 Hash support
2348 
2349 namespace std {
2350 
2351 template<>
2352 struct hash< nonstd::monostate >
2353 {
2354  std::size_t operator()( nonstd::monostate ) const variant_noexcept
2355  {
2356  return 42;
2357  }
2358 };
2359 
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> >
2362 {
2364  {
2365  namespace nvd = nonstd::variants::detail;
2366 
2367  switch( v.index() )
2368  {
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 ) );
2385 
2386  default: return false;
2387  }
2388  }
2389 };
2390 
2391 } //namespace std
2392 
2393 #endif // variant_CPP11_OR_GREATER
2394 
2395 #if variant_BETWEEN( variant_COMPILER_MSVC_VER, 1300, 1900 )
2396 # pragma warning( pop )
2397 #endif
2398 
2399 #endif // variant_USES_STD_VARIANT
2400 
2401 #endif // NONSTD_VARIANT_LITE_HPP
nonstd::variants::detail::TypedVisitorUnwrapper< 4, R, Visitor, T2, T3, T4 >::operator()
R operator()(const T &val1) const
Definition: variant.hpp:2002
nonstd::variants::variant::operator=
variant & operator=(T11 const &t11)
Definition: variant.hpp:1398
nonstd::variants::detail::TX::operator==
bool operator==(T const &) const
Definition: variant.hpp:582
nonstd::variants::variant::operator=
variant & operator=(T9 const &t9)
Definition: variant.hpp:1396
nonstd::variants::variant::variant
variant(T5 const &t5)
Definition: variant.hpp:1223
nonstd::variants::variant::variant
variant(T15 const &t15)
Definition: variant.hpp:1233
nonstd::variants::monostate
Definition: variant.hpp:1105
nonstd::variants::detail::T5
TX< S5 > T5
Definition: variant.hpp:598
variant_noexcept
#define variant_noexcept
Definition: variant.hpp:358
nonstd::variants::detail::helper::as
static U * as(void *data)
Definition: variant.hpp:933
nonstd::variants::detail::TX::operator~
TX< T > operator~() const
Definition: variant.hpp:568
nonstd::variants::detail::S4
Definition: variant.hpp:597
nonstd::variants::detail::TypedVisitorUnwrapper< 3, R, Visitor, T2, T3 >::visitor
const Visitor & visitor
Definition: variant.hpp:1965
nonstd::variants::detail::TypedVisitorUnwrapper< 2, R, Visitor, T2 >::visitor
const Visitor & visitor
Definition: variant.hpp:1945
nonstd::variants::detail::Comparator
Definition: variant.hpp:2231
nonstd::variants::detail::typelist_index_of
Definition: variant.hpp:708
nonstd::variants::detail::TX
Definition: variant.hpp:563
nonstd::variants::detail::T12
TX< S12 > T12
Definition: variant.hpp:605
nonstd::variants::detail::VisitorUnwrapper::operator()
R operator()(T1 const &val1, T2 const &val2, T3 const &val3, T4 const &val4) const
Definition: variant.hpp:2071
nonstd::variants::detail::VisitorUnwrapper::r
const V2 & r
Definition: variant.hpp:2040
nonstd::variants::detail::typelist_size< T4 >::V
V
Definition: variant.hpp:683
nonstd::optional_lite::std11::move
T & move(T &t)
Definition: optional.hpp:421
nonstd::variants::variant_size
Definition: variant.hpp:1121
nonstd::variants::variant::variant
variant(T1 const &t1)
Definition: variant.hpp:1219
nonstd::variants::variant::variant
variant(T0 const &t0)
Definition: variant.hpp:1218
nonstd::variants::detail::typelist_size< T2 >::V
V
Definition: variant.hpp:681
nonstd::variants::detail::Comparator::less_than
static bool less_than(Variant const &v, Variant const &w)
Definition: variant.hpp:2257
nonstd::variants::variant_alternative
Definition: variant.hpp:1141
nonstd::variants::detail
Definition: variant.hpp:533
nonstd::variants::std11::remove_volatile
Definition: variant.hpp:446
nonstd::variants::detail::TypedVisitorUnwrapper< 2, R, Visitor, T2 >::TypedVisitorUnwrapper
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_)
Definition: variant.hpp:1948
nonstd::variants::detail::type_of_size
Definition: variant.hpp:842
nonstd::variants::get
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))
Definition: variant.hpp:1753
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::val3
T3 const & val3
Definition: variant.hpp:2013
nonstd::variants::detail::VisitorApplicatorImpl
Definition: variant.hpp:1911
nonstd::variants::detail::typelist_index_of< typelist< T, Tail >, T >::V
V
Definition: variant.hpp:719
variant_TL16
#define variant_TL16(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)
Definition: variant.hpp:556
nonstd::variants::operator==
variant_constexpr bool operator==(monostate, monostate) variant_noexcept
Definition: variant.hpp:1113
nonstd::variants::variant::variant
variant(T14 const &t14)
Definition: variant.hpp:1232
nonstd::variants::detail::TypedVisitorUnwrapper< 4, R, Visitor, T2, T3, T4 >::val3
T3 const & val3
Definition: variant.hpp:1989
nonstd::variants::variant::operator=
variant & operator=(T1 const &t1)
Definition: variant.hpp:1388
nonstd::variants::detail::typelist_max< typelist< Head, Tail > >::V
V
Definition: variant.hpp:641
nonstd::variants::detail::TypedVisitorUnwrapper< 4, R, Visitor, T2, T3, T4 >::visitor
const Visitor & visitor
Definition: variant.hpp:1987
nonstd::variants::detail::T4
TX< S4 > T4
Definition: variant.hpp:597
nonstd::variants::detail::alignment_logic
Definition: variant.hpp:829
nonstd::variants::detail::typelist_size< T8 >::V
V
Definition: variant.hpp:687
nonstd::variants::detail::VisitorApplicator::apply
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3, V4 const &arg4)
Definition: variant.hpp:2155
nonstd::variants::detail::variant_ALIGN_TYPE
typedef variant_ALIGN_TYPE(char)
nonstd::variants::get
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))
Definition: variant.hpp:1781
nonstd::variants::detail::typelist_size< typelist< Head, Tail > >::V
V
Definition: variant.hpp:702
nonstd::variants::detail::TypedVisitorUnwrapper< 2, R, Visitor, T2 >::val2
T2 const & val2
Definition: variant.hpp:1946
nonstd::variants::detail::typelist_size< T3 >::V
V
Definition: variant.hpp:682
nonstd::variants::detail::typelist_max< typelist< Head, Tail > >::type
std11::conditional<(sizeof(Head) > tail_value), Head, tail_type >::type type
Definition: variant.hpp:643
nonstd::variants::detail::T15
TX< S15 > T15
Definition: variant.hpp:608
nonstd::variants::std11::remove_reference::type
T type
Definition: variant.hpp:427
nonstd::variants::detail::TX::operator-
TX< T > operator-() const
Definition: variant.hpp:565
nonstd::variants::detail::helper
Definition: variant.hpp:928
nonstd::variants::detail::S8
Definition: variant.hpp:601
nonstd::variants::std11::remove_const< const T >::type
T type
Definition: variant.hpp:444
nonstd::variants::variant::operator=
variant & operator=(T2 const &t2)
Definition: variant.hpp:1389
nonstd::variants::detail::typelist_size
Definition: variant.hpp:675
nonstd::variants::variant::operator=
variant & operator=(T4 const &t4)
Definition: variant.hpp:1391
nonstd::variants::detail::T8
TX< S8 > T8
Definition: variant.hpp:601
nonstd::variants::detail::VisitorUnwrapper
Definition: variant.hpp:1933
nonstd::variants::detail::VisitorApplicatorImpl< R, TX< VT > >::apply
static R apply(Visitor const &, T)
Definition: variant.hpp:1923
nonstd::variants::detail::alignment_of_hack::alignment_of_hack
alignment_of_hack()
nonstd::variants::detail::VisitorApplicator::apply
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3, V4 const &arg4, V5 const &arg5)
Definition: variant.hpp:2163
nonstd::variants::detail::helper::as
static U const * as(void const *data)
Definition: variant.hpp:939
nonstd::variants::detail::TypedVisitorUnwrapper< 3, R, Visitor, T2, T3 >::val2
T2 const & val2
Definition: variant.hpp:1966
nonstd::variants::detail::S5
Definition: variant.hpp:598
nonstd::variants::variant::get
variant_alternative< K, variant >::type & get()
Definition: variant.hpp:1553
nonstd::variants::variant::operator=
variant & operator=(T5 const &t5)
Definition: variant.hpp:1392
nonstd::variants::detail::T9
TX< S9 > T9
Definition: variant.hpp:602
nonstd::variants::detail::VisitorApplicator::apply
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2)
Definition: variant.hpp:2139
nonstd::variants::detail::TypedVisitorUnwrapper< 3, R, Visitor, T2, T3 >::TypedVisitorUnwrapper
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_)
Definition: variant.hpp:1969
nonstd::variants::variant::index
std::size_t index() const
Definition: variant.hpp:1405
nonstd::variants::detail::TypedVisitorUnwrapper< 4, R, Visitor, T2, T3, T4 >::TypedVisitorUnwrapper
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_, T4 const &val4_)
Definition: variant.hpp:1992
nonstd::variants::detail::nulltype
Definition: variant.hpp:611
nonstd::variants::detail::S13
Definition: variant.hpp:606
nonstd::variants::detail::alignment_of_hack::t
T t
Definition: variant.hpp:823
nonstd::variants::variant::get
T & get()
Definition: variant.hpp:1520
nonstd_lite_in_place_type
#define nonstd_lite_in_place_type(T)
Definition: variant.hpp:162
nonstd::variants::detail::typelist_type_at
Definition: variant.hpp:735
nonstd::variants::detail::alignment_of
Definition: variant.hpp:817
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::TypedVisitorUnwrapper
TypedVisitorUnwrapper(const Visitor &visitor_, T2 const &val2_, T3 const &val3_, T4 const &val4_, T5 const &val5_)
Definition: variant.hpp:2017
nonstd::variants::std11::remove_const
Definition: variant.hpp:443
nonstd::variants::detail::typelist_type_at< typelist< Head, Tail >, i >::type
typelist_type_at< Tail, i - 1 >::type type
Definition: variant.hpp:746
nonstd::variants::detail::typelist_type_at< typelist< Head, Tail >, 0 >::type
Head type
Definition: variant.hpp:740
nonstd::variants::variant::variant
variant(T12 const &t12)
Definition: variant.hpp:1230
nonstd::variants::detail::struct_t::_
T _
Definition: variant.hpp:856
nonstd::variants::detail::T13
TX< S13 > T13
Definition: variant.hpp:606
nonstd::variants::detail::typelist_size< T10 >::V
V
Definition: variant.hpp:689
nonstd::variants::get_if
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))
Definition: variant.hpp:1863
nonstd::variants::detail::typelist_size< nulltype >::V
V
Definition: variant.hpp:697
nonstd::variants::std11::remove_cv::type
remove_volatile< typename remove_const< T >::type >::type type
Definition: variant.hpp:452
nonstd::variants::detail::type_of_size< nulltype, N >::type
variant_CONFIG_ALIGN_AS_FALLBACK type
Definition: variant.hpp:852
nonstd::variants::detail::VisitorUnwrapper::operator()
R operator()(T1 const &val1) const
Definition: variant.hpp:2050
nonstd::variants::detail::TX::operator&
TX< T > * operator&() const
Definition: variant.hpp:570
nonstd::variants::variant::variant
variant()
Definition: variant.hpp:1216
nonstd::variants::detail::VisitorApplicator
Definition: variant.hpp:1930
nonstd::variants::std11::remove_reference< T & >::type
T type
Definition: variant.hpp:428
nonstd::variants::detail::typelist_size< T13 >::V
V
Definition: variant.hpp:692
nonstd::variants::std11::remove_volatile< volatile T >::type
T type
Definition: variant.hpp:447
nonstd::variants::detail::T11
TX< S11 > T11
Definition: variant.hpp:604
nonstd::variants::detail::S9
Definition: variant.hpp:602
nonstd::variants::variant::operator=
variant & operator=(T10 const &t10)
Definition: variant.hpp:1397
nonstd::variants::std11::remove_volatile::type
T type
Definition: variant.hpp:446
nonstd::variants::detail::typelist_max< nulltype >::type
void type
Definition: variant.hpp:629
nonstd::variants::variant::variant
variant(T2 const &t2)
Definition: variant.hpp:1220
nonstd::variants::operator>=
variant_constexpr bool operator>=(monostate, monostate) variant_noexcept
Definition: variant.hpp:1112
nonstd_lite_in_place_index
#define nonstd_lite_in_place_index(K)
Definition: variant.hpp:163
nonstd::variants::variant::variant
variant(T7 const &t7)
Definition: variant.hpp:1225
nonstd::variants::detail::typelist_size< T12 >::V
V
Definition: variant.hpp:691
nonstd::variants::detail::struct_t
Definition: variant.hpp:856
nonstd::variants::detail::typelist_max
Definition: variant.hpp:623
variant_override
#define variant_override
Definition: variant.hpp:370
nonstd::variants::detail::T7
TX< S7 > T7
Definition: variant.hpp:600
nonstd::variants::detail::TypedVisitorUnwrapper
Definition: variant.hpp:1940
nonstd::variants::detail::VisitorUnwrapper::visitor
const Visitor & visitor
Definition: variant.hpp:2039
nonstd::variants::variant::swap
void swap(variant &other)
Definition: variant.hpp:1464
nonstd::variants::detail::TX::operator*
TX< T > operator*(U const &) const
Definition: variant.hpp:572
nonstd::variants::visit
R visit(const Visitor &v, V1 const &arg1)
Definition: variant.hpp:2194
nonstd::variants::detail::TX::operator||
TX< T > operator||(U const &) const
Definition: variant.hpp:590
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::val4
T4 const & val4
Definition: variant.hpp:2014
nonstd::variants::std11::add_pointer::type
remove_reference< T >::type * type
Definition: variant.hpp:432
nonstd::variants::detail::Comparator::equal
static bool equal(Variant const &v, Variant const &w)
Definition: variant.hpp:2232
nonstd::variants::detail::S0
Definition: variant.hpp:593
nonstd::variants::variant::operator=
variant & operator=(T0 const &t0)
Definition: variant.hpp:1387
nonstd::variants::detail::alignment_of_hack::c
char c
Definition: variant.hpp:822
nonstd::variants::detail::typelist
Definition: variant.hpp:615
nonstd::variants::variant::variant
variant(T6 const &t6)
Definition: variant.hpp:1224
nonstd::variants::detail::S6
Definition: variant.hpp:599
nonstd::variants::detail::helper::variant_TL16
typedef variant_TL16(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) variant_types
nonstd::variants::variant::valueless_by_exception
bool valueless_by_exception() const
Definition: variant.hpp:1457
nonstd::variants::variant_npos
static const std::size_t variant_npos
Definition: variant.hpp:1166
nonstd::variants::detail::typelist_index_of< nulltype, T >::V
V
Definition: variant.hpp:713
nonstd::variants::variant::operator=
variant & operator=(T12 const &t12)
Definition: variant.hpp:1399
nonstd::variants::detail::VisitorApplicator::apply
static R apply(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3)
Definition: variant.hpp:2147
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::val5
T5 const & val5
Definition: variant.hpp:2015
nonstd::variants::detail::T1
TX< S1 > T1
Definition: variant.hpp:594
nonstd::variants::detail::type_of_size::type
std11::conditional< N==sizeof(typename List::head), typename List::head, typename type_of_size< typename List::tail, N >::type >::type type
Definition: variant.hpp:846
nonstd::variants::detail::S12
Definition: variant.hpp:605
nonstd::variants::detail::typelist_size< T15 >::V
V
Definition: variant.hpp:694
nonstd
Definition: any.hpp:110
nonstd::variants::variant::get
T const & get() const
Definition: variant.hpp:1536
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::operator()
R operator()(const T &val1) const
Definition: variant.hpp:2028
nonstd::variants::detail::S11
Definition: variant.hpp:604
nonstd::variants::detail::typelist_size< T11 >::V
V
Definition: variant.hpp:690
nonstd::variants::detail::typelist_size< T7 >::V
V
Definition: variant.hpp:686
nonstd::variants::detail::S14
Definition: variant.hpp:607
nonstd::in_place_type
in_place_t in_place_type(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
Definition: any.hpp:136
nonstd::variants::detail::VisitorApplicatorImpl::apply
static R apply(Visitor const &v, T const &arg)
Definition: variant.hpp:1913
nonstd::variants::detail::enabler
Definition: variant.hpp:537
nonstd::variants::detail::TX::operator&&
TX< T > operator&&(U const &) const
Definition: variant.hpp:589
nonstd::variants::detail::helper::copy_assign
static type_index_t copy_assign(type_index_t const from_index, const void *from_value, void *to_value)
Definition: variant.hpp:1068
nonstd::variants::variant::operator=
variant & operator=(T3 const &t3)
Definition: variant.hpp:1390
nonstd::variants::variant::operator=
variant & operator=(T13 const &t13)
Definition: variant.hpp:1400
nonstd::variants::detail::T14
TX< S14 > T14
Definition: variant.hpp:607
nonstd::in_place_index
in_place_t in_place_index(detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
Definition: any.hpp:142
nonstd::variants::detail::TypedVisitorUnwrapper< 3, R, Visitor, T2, T3 >::val3
T3 const & val3
Definition: variant.hpp:1967
nonstd::variants::detail::typelist_size< T14 >::V
V
Definition: variant.hpp:693
nonstd::variants::detail::typelist::head
Head head
Definition: variant.hpp:616
nonstd::variants::detail::TX::operator/
TX< T > operator/(U const &) const
Definition: variant.hpp:573
nonstd::variants::detail::typelist_size< T9 >::V
V
Definition: variant.hpp:688
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
Definition: variant.hpp:1146
nonstd::variants::std11::conditional
Definition: variant.hpp:464
nonstd::variants::detail::helper::to_index_t
static type_index_t to_index_t(std::size_t index)
Definition: variant.hpp:944
variant_CONFIG_ALIGN_AS_FALLBACK
#define variant_CONFIG_ALIGN_AS_FALLBACK
Definition: variant.hpp:242
nonstd::variants::detail::VisitorUnwrapper::operator()
R operator()(T1 const &val1, T2 const &val2) const
Definition: variant.hpp:2057
variant_constexpr
#define variant_constexpr
Definition: variant.hpp:346
nonstd::variants::detail::typelist::tail
Tail tail
Definition: variant.hpp:617
nonstd::variants::variant::operator=
variant & operator=(T15 const &t15)
Definition: variant.hpp:1402
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::visitor
const Visitor & visitor
Definition: variant.hpp:2011
nonstd::variants::detail::TypedVisitorUnwrapper< 4, R, Visitor, T2, T3, T4 >::val4
T4 const & val4
Definition: variant.hpp:1990
nonstd::variants::std11::conditional< true, Then, Else >::type
Then type
Definition: variant.hpp:467
nonstd::variants::operator<=
variant_constexpr bool operator<=(monostate, monostate) variant_noexcept
Definition: variant.hpp:1111
nonstd::variants::detail::TX::operator!
TX< T > operator!() const
Definition: variant.hpp:567
nonstd::variants::operator!=
variant_constexpr bool operator!=(monostate, monostate) variant_noexcept
Definition: variant.hpp:1114
nonstd::variants::detail::VisitorUnwrapper::VisitorUnwrapper
VisitorUnwrapper(const Visitor &visitor_, const V2 &r_)
Definition: variant.hpp:2042
nonstd::variants::holds_alternative
bool holds_alternative(variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > const &v) variant_noexcept
Definition: variant.hpp:1747
nonstd::variants::detail::VisitorApplicator::apply
static R apply(const Visitor &v, const V1 &arg)
Definition: variant.hpp:2091
nonstd::variants::detail::T10
TX< S10 > T10
Definition: variant.hpp:603
nonstd::variants::detail::typelist_size< T5 >::V
V
Definition: variant.hpp:684
nonstd::variants::detail::typelist_size::V
V
Definition: variant.hpp:676
nonstd::variants::std11::remove_const::type
T type
Definition: variant.hpp:443
nonstd::variants::detail::VisitorUnwrapper::operator()
R operator()(T1 const &val1, T2 const &val2, T3 const &val3) const
Definition: variant.hpp:2064
nonstd::variants::detail::S1
Definition: variant.hpp:594
nonstd::variants::std11::add_pointer
Definition: variant.hpp:431
nonstd::variants::detail::TypedVisitorUnwrapper< 3, R, Visitor, T2, T3 >::operator()
R operator()(const T &val1) const
Definition: variant.hpp:1978
nonstd::variants::detail::TX::operator<<
TX< T > operator<<(U const &) const
Definition: variant.hpp:579
nonstd_lite_in_place_index_t
#define nonstd_lite_in_place_index_t(K)
Definition: variant.hpp:159
nonstd::variants::operator>
variant_constexpr bool operator>(monostate, monostate) variant_noexcept
Definition: variant.hpp:1110
nonstd::variants::detail::TX::operator+
TX< T > operator+() const
Definition: variant.hpp:564
nonstd::variants::detail::typelist_size< T1 >::V
V
Definition: variant.hpp:680
nonstd::variants::detail::TX::operator>>
TX< T > operator>>(U const &) const
Definition: variant.hpp:580
nonstd::variants::variant::variant
variant(variant const &other)
Definition: variant.hpp:1256
nonstd::variants::variant::variant
variant(T10 const &t10)
Definition: variant.hpp:1228
nonstd::variants::detail::typelist_size::value
@ value
Definition: variant.hpp:676
nonstd::variants::variant::variant
variant(T11 const &t11)
Definition: variant.hpp:1229
nonstd::variants::variant::operator=
variant & operator=(variant const &other)
Definition: variant.hpp:1339
nonstd::variants::std11::conditional< false, Then, Else >::type
Else type
Definition: variant.hpp:470
nonstd::variants::get_if
std11::add_pointer< T >::type 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))
Definition: variant.hpp:1842
nonstd::variants::detail::alignment_types
nulltype alignment_types
Definition: variant.hpp:888
nonstd::variants::variant::variant
variant(T8 const &t8)
Definition: variant.hpp:1226
nonstd::variants::visit
R visit(const Visitor &v, V1 const &arg1, V2 const &arg2, V3 const &arg3, V4 const &arg4, V5 const &arg5)
Definition: variant.hpp:2218
nonstd::variants::detail::TypedVisitorUnwrapper< 2, R, Visitor, T2 >::operator()
R operator()(const T &val1) const
Definition: variant.hpp:1956
nonstd::variants::detail::TypedVisitorUnwrapper< 4, R, Visitor, T2, T3, T4 >::val2
T2 const & val2
Definition: variant.hpp:1988
nonstd::variants::detail::TX::operator^
TX< T > operator^(U const &) const
Definition: variant.hpp:587
nonstd::variants::detail::typelist_size< T0 >::V
V
Definition: variant.hpp:679
nonstd::variants::swap
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)
Definition: variant.hpp:1892
nonstd::variants::detail::typelist_index_of< typelist< Head, Tail >, T >::V
V
Definition: variant.hpp:729
nonstd::variants::detail::TypedVisitorUnwrapper< 5, R, Visitor, T2, T3, T4, T5 >::val2
T2 const & val2
Definition: variant.hpp:2012
nonstd::variants::variant::index_of
static variant_constexpr std::size_t index_of() variant_noexcept
Definition: variant.hpp:1514
nonstd::variants::detail::alignment_logic::V
V
Definition: variant.hpp:830
nonstd::variants::variant::variant
variant(T4 const &t4)
Definition: variant.hpp:1222
nonstd::variants::detail::typelist_max< nulltype >::V
V
Definition: variant.hpp:628
nonstd::variants::detail::helper::destroy
static void destroy(type_index_t index, void *data)
Definition: variant.hpp:949
nonstd::variants::detail::VisitorApplicator::apply_visitor
static R apply_visitor(const Visitor &v, const V1 &arg)
Definition: variant.hpp:2117
nonstd::variants::operator<
variant_constexpr bool operator<(monostate, monostate) variant_noexcept
Definition: variant.hpp:1109
nonstd::variants::detail::S3
Definition: variant.hpp:596
nonstd::variants::detail::T2
TX< S2 > T2
Definition: variant.hpp:595
nonstd::variants::detail::T3
TX< S3 > T3
Definition: variant.hpp:596
nonstd::variants::variant::~variant
~variant()
Definition: variant.hpp:1329
nonstd::variants::detail::helper::copy_construct
static type_index_t copy_construct(type_index_t const from_index, const void *from_value, void *to_value)
Definition: variant.hpp:1043
variant_nullptr
#define variant_nullptr
Definition: variant.hpp:364
nonstd::variants::detail::T0
TX< S0 > T0
Definition: variant.hpp:593
nonstd::variants::detail::alignment_of::V
V
Definition: variant.hpp:836
nonstd::variants::variant::operator=
variant & operator=(T8 const &t8)
Definition: variant.hpp:1395
nonstd::variants::variant::operator=
variant & operator=(T7 const &t7)
Definition: variant.hpp:1394
nonstd::variants::variant::variant
variant(T9 const &t9)
Definition: variant.hpp:1227
nonstd::variants::detail::helper::type_index_t
signed char type_index_t
Definition: variant.hpp:929
nonstd::variants::variant::variant
variant(T13 const &t13)
Definition: variant.hpp:1231
nonstd::variants::detail::TX::operator|
TX< T > operator|(U const &) const
Definition: variant.hpp:586
nonstd::variants::detail::T6
TX< S6 > T6
Definition: variant.hpp:599
nonstd::variants::detail::S15
Definition: variant.hpp:608
nonstd::variants::variant::operator=
variant & operator=(T6 const &t6)
Definition: variant.hpp:1393
nonstd_lite_in_place_type_t
#define nonstd_lite_in_place_type_t(T)
Definition: variant.hpp:158
nonstd::variants::detail::VisitorUnwrapper::operator()
R operator()(T1 const &val1, T2 const &val2, T3 const &val3, T4 const &val4, T5 const &val5) const
Definition: variant.hpp:2078
nonstd::variants::detail::S2
Definition: variant.hpp:595
nonstd::variants::detail::TX::operator%
TX< T > operator%(U const &) const
Definition: variant.hpp:575
nonstd::variants::detail::alignment_of::value
@ value
Definition: variant.hpp:836
nonstd::variants::detail::TX::operator<
bool operator<(T const &) const
Definition: variant.hpp:583
nonstd::variants::variant::get
variant_alternative< K, variant >::type const & get() const
Definition: variant.hpp:1560
nonstd::variants::variant
Definition: variant.hpp:1101
nonstd::variants::detail::S10
Definition: variant.hpp:603
nonstd::variants::std11::remove_reference
Definition: variant.hpp:427
nonstd::in_place
in_place_t in_place(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
Definition: any.hpp:124
nonstd::variants::variant::operator=
variant & operator=(T14 const &t14)
Definition: variant.hpp:1401
nonstd::variants::std11::remove_cv
Definition: variant.hpp:451
nonstd::variants::detail::S7
Definition: variant.hpp:600
nonstd::variants::detail::alignment_of_hack
Definition: variant.hpp:821
nonstd::variants::variant::variant
variant(T3 const &t3)
Definition: variant.hpp:1221
nonstd::variants::variant_size< variant< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 > >::_
_
Definition: variant.hpp:1126
nonstd::variants::detail::typelist_size< T6 >::V
V
Definition: variant.hpp:685