BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlb_variant_cpp03.h
Go to the documentation of this file.
1/// @file bdlb_variant_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlb_variant_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BDLB_VARIANT_CPP03
12#define INCLUDED_BDLB_VARIANT_CPP03
13
14/// @defgroup bdlb_variant_cpp03 bdlb_variant_cpp03
15/// @brief Provide C++03 implementation for bdlb_variant.h
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlb
19/// @{
20/// @addtogroup bdlb_variant_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlb_variant_cpp03-purpose"> Purpose</a>
25/// * <a href="#bdlb_variant_cpp03-classes"> Classes </a>
26/// * <a href="#bdlb_variant_cpp03-description"> Description </a>
27///
28/// # Purpose {#bdlb_variant_cpp03-purpose}
29/// Provide C++03 implementation for bdlb_variant.h
30///
31/// # Classes {#bdlb_variant_cpp03-classes}
32/// See bdlb_variant.h for list of classes
33///
34/// @see bdlb_variant
35///
36/// # Description {#bdlb_variant_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Sun Sep 1 06:01:47 2024
48/// Command line: sim_cpp11_features.pl bdlb_variant.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bdl
54 * @{
55 */
56/** @addtogroup bdlb
57 * @{
58 */
59/** @addtogroup bdlb_variant_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BDLB_VARIANT_H
64
65#if defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES) \
66 && defined(BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES)
67/// Note that this macro definition parallels that of a similar macro
68/// defined in `bslmf_typelist.h`.
69#define BDLB_VARIANT_USING_VARIADIC_TEMPLATES
70#endif
71
72
73namespace bdlb {
74
75struct Variant_CopyAssignVisitor;
76struct Variant_CopyConstructVisitor;
77struct Variant_DefaultConstructVisitor;
78struct Variant_DestructorVisitor;
79struct Variant_EqualityTestVisitor;
80struct Variant_MoveAssignVisitor;
81struct Variant_MoveConstructVisitor;
82struct Variant_PrintVisitor;
83
84template <class TYPES>
85class VariantImp;
86
87template <class TYPES, class TYPE>
88struct Variant_TypeIndex;
89
90 // ================================
91 // struct Variant_ReturnValueHelper
92 // ================================
93
94// These definitions are provided outside of 'Variant_ReturnValueHelper'
95// because of a bug in the IBM xlC compiler.
97typedef struct { char a[2]; } Variant_ReturnValueHelper_NoType;
98
100 != sizeof(Variant_ReturnValueHelper_NoType));
101
102/// This struct is a component-private struct. Do *not* use. This provides
103/// functions, the matching of which are used by Variant_ReturnValueHelper
104/// to determine whether the template parameter type `VISITOR` has the
105/// member `ResultType` defined.
106struct Variant_ReturnValueHelper_Matcher {
107
108 /// Return `YesType` if `T::ResultType` exists, and `NoType` otherwise.
109 /// Note that if `T::ResultType` exists, then the first function is a
110 /// better match than the ellipsis version.
111 template <class T>
113 typename bsl::remove_reference<typename T::ResultType>::type *);
114 template <class T>
115 static Variant_ReturnValueHelper_NoType match(...);
116};
117
118/// This struct is a component-private meta-function. Do *not* use. This
119/// meta-function checks whether the template parameter type `VISITOR` has
120/// the member `ResultType` defined using "SFINAE" (Substitution Failure Is
121/// Not An Error). A `value` of `true` indicates `VISITOR::ResultType`
122/// exists, and `false` otherwise.
123template <class VISITOR>
124struct Variant_ReturnValueHelper
126 bool,
127 sizeof(Variant_ReturnValueHelper_Matcher::match<VISITOR>(0)) ==
128 sizeof(Variant_ReturnValueHelper_YesType)> {
129};
130
131 // =====================================
132 // class VariantImp_AllocatorBase<TYPES>
133 // =====================================
134
135/// This class is component-private. Do not use. This class contains the
136/// `typedef`s and data members of the `Variant` class, and serves as the
137/// base class for the variant when any one of the types held by the variant
138/// has the `bslma::UsesBslmaAllocator` type trait.
139///
140/// See @ref bdlb_variant_cpp03
141template <class TYPES>
142class VariantImp_AllocatorBase {
143
144 public:
145 // TYPES
146
147 /// `TypeList` is an alias for the `bslmf::TypeList` type serving as the
148 /// template parameter to this variant implementation.
149 typedef TYPES TypeList;
150
170
171 /// `TypeN` is an alias for the `N`th type in the `TypeList` of this
172 /// variant implementation. If less than `N` template arguments were
173 /// given to the `Variant` type, then `TypeN` is `bslmf::Nil`.
175
176 private:
177 union Value {
198 };
199 // 'Value' is a union of 'bsls::ObjectBuffer' of all types contained by
200 // the variant. 'bsls::ObjectBuffer' is used to: 1) wrap non-POD types
201 // within the union, and 2) ensure proper alignment of the types.
202
203 // DATA
204 Value d_value; // value of the object, initialized by
205 // derived class
206
207 int d_type; // current type the variant is holding (0
208 // if unset)
209
210 bslma::Allocator *d_allocator_p; // pointer to allocator (held, not owned)
211
212 // FRIENDS
213 template <class VARIANT_TYPES>
214 friend class VariantImp;
215
216 template <class VARIANT_TYPES>
217 friend bool operator==(const VariantImp<VARIANT_TYPES>&,
218 const VariantImp<VARIANT_TYPES>&);
219
220 public:
221 // TRAITS
222 BSLMF_NESTED_TRAIT_DECLARATION(VariantImp_AllocatorBase,
224
225 // CREATORS
226 VariantImp_AllocatorBase(int type, bslma::Allocator *basicAllocator);
227
228 /// Create a `VariantImp_AllocatorBase` with the specified `type`
229 /// indicating the type of the object that the variant will initially
230 /// hold, and the specified `basicAllocator` to supply memory.
232 bslma::Allocator *basicAllocator,
234
235 template <class TYPE>
236 VariantImp_AllocatorBase(int type, const TYPE&, bsl::false_type);
237
238 // ACCESSORS
239
240 /// Return the allocator used by this object to supply memory.
242};
243
244 // =======================================
245 // class VariantImp_NoAllocatorBase<TYPES>
246 // =======================================
247
248/// This class is component-private. Do not use. This class contains the
249/// `typedef`s and data members of the `Variant` class, and serves as the
250/// base class for the variant when none of the types held by the variant
251/// has the `bslma::UsesBslmaAllocator` type trait. The goal is to optimize
252/// the size of the variant to avoid holding an unnecessary allocator
253/// pointer.
254///
255/// See @ref bdlb_variant_cpp03
256template <class TYPES>
257class VariantImp_NoAllocatorBase {
258
259 public:
260 // TYPES
261
262 /// `TypeList` is an alias for the `bslmf::TypeList` type serving as the
263 /// template parameter to this variant implementation.
264 typedef TYPES TypeList;
265
285
286 /// `TypeN` is an alias for the `N`th type in the `TypeList` of this
287 /// variant implementation. If less than `N` template arguments were
288 /// given to the `Variant` type, then `TypeN` is `bslmf::Nil`.
290
291 private:
292 union Value {
313 };
314 // 'Value' is a union of 'bsls::ObjectBuffer' of all types contained by
315 // the variant. 'bsls::ObjectBuffer' is used to: 1) wrap non-POD types
316 // within the union, and 2) ensure proper alignment of the types.
317
318 // DATA
319 Value d_value; // value of the object, initialized by derived class
320 int d_type; // current type the variant is holding (0 if unset)
321
322 // FRIENDS
323 template <class VARIANT_TYPES>
324 friend class VariantImp;
325
326 template <class VARIANT_TYPES>
327 friend bool operator==(const VariantImp<VARIANT_TYPES>&,
328 const VariantImp<VARIANT_TYPES>&);
329
330 public:
331 // CREATORS
333
334 /// Create a `VariantImp_NoAllocatorBase` with the specified `type`
335 /// indicating the type of the object that the variant will initially
336 /// hold.
338
339 template <class TYPE>
340 VariantImp_NoAllocatorBase(int type, const TYPE&, bsl::false_type);
341
342 // ACCESSORS
343
344 /// Return 0. Note that this object does not hold an allocator pointer.
346};
347
348 // ========================
349 // struct VariantImp_Traits
350 // ========================
351
352/// This struct is component-private. Do not use. This meta-function
353/// selects `VariantImp_AllocatorBase` as a base class type if any one of
354/// the types held by a variant has the `bslma::UsesBslmaAllocator` trait,
355/// and `VariantImp_NoAllocatorBase` otherwise.
356template <class TYPES>
357struct VariantImp_Traits {
358
359 // TYPES
380
381 enum {
403
425
447#ifndef BDE_OMIT_INTERNAL_DEPRECATED
451#endif // BDE_OMIT_INTERNAL_DEPRECATED
452 };
453
454 /// Determines what the base type is.
456 VariantImp_AllocatorBase<TYPES>,
457 VariantImp_NoAllocatorBase<TYPES> >::type
458 BaseType;
459};
460
461 // ==============================
462 // class Variant_RawVisitorHelper
463 // ==============================
464
465/// This `struct` provides a helper for implementing `Variant::applyRaw`
466/// that enables `applyRaw` to support visitor functors that do not provide
467/// an overload for `operator()(bslmf::Nil)`. Objects of this type are
468/// constructed using a functor of (template parameter) type `VISITOR`,
469/// whose `operator()` returns the (template parameter) type `RESULT_TYPE`.
470/// A `Variant_RawVisitorHelper` wraps a functor of type `VISITOR` and
471/// provides an implementation of `operator()(bslmf::Nil)` that performs a
472/// `BSLS_ASSERT_OPT(false)`. Note that this overload is needed to enable
473/// compilation (specifically, to instantiate `doApply` and `doApplyR`), but
474/// is never invoked by any code path at runtime.
475///
476/// See @ref bdlb_variant_cpp03
477template <class RESULT_TYPE, class VISITOR>
478class Variant_RawVisitorHelper {
479
480 // DATA
481 VISITOR *d_visitor; // visitor to which this helper delegates
482
483 public:
484 // CREATORS
485
486 /// Create a `RawVisitorHelper` functor that delegates to the specified
487 /// `visitor`.
488 explicit
489 Variant_RawVisitorHelper(VISITOR *visitor);
490
491 // MANIPULATORS
492
493 /// Invoke the functor supplied at construction with the specified
494 /// `argument`, and return the result.
495 template <class ARGUMENT_TYPE>
496 RESULT_TYPE operator()(ARGUMENT_TYPE& argument);
497 template <class ARGUMENT_TYPE>
498 RESULT_TYPE operator()(const ARGUMENT_TYPE& argument);
499
500 // ACCESSORS
501
502 /// Invoke the functor supplied at construction with the specified
503 /// `argument`, and return the result.
504 template <class ARGUMENT_TYPE>
505 RESULT_TYPE operator()(ARGUMENT_TYPE& argument) const;
506 template <class ARGUMENT_TYPE>
507 RESULT_TYPE operator()(const ARGUMENT_TYPE& argument) const;
508
509 /// Do not call. The behavior of this method is undefined.
510 RESULT_TYPE operator()(bslmf::Nil) const;
511};
512
513 // =======================
514 // class VariantImp<TYPES>
515 // =======================
516
517/// This class provides the implementation of `Variant` (except for the
518/// creators) given a list of template parameter `TYPES`.
519///
520/// More generally, if each of the types in the list of `TYPES` is
521/// value semantic, then this class also supports a complete set of *value*
522/// *semantic* operations, including copy construction, assignment, equality
523/// comparison, and `ostream` printing. A precise operational definition of
524/// when two instances have the same value can be found in the description
525/// of `operator==` for the class. This class is *exception* *neutral* with
526/// no guarantee of rollback: if an exception is thrown during the
527/// invocation of a method on a pre-existing instance, the object is left in
528/// a valid state, but its value is undefined. In no event is memory
529/// leaked. Finally, *aliasing* (e.g., using all or part of an object as
530/// both source and destination) is supported in all cases.
531///
532/// If any of the types in the list of `TYPES` does not support
533/// `operator==`, or any of the value-semantic operations mentioned above,
534/// then this variant also does not support that operation and attempts to
535/// invoke it will trigger a compilation diagnostic.
536///
537/// See @ref bdlb_variant_cpp03
538template <class TYPES>
539class VariantImp : public VariantImp_Traits<TYPES>::BaseType {
540
541 // PRIVATE TYPES
542 typedef VariantImp_Traits<TYPES> Traits;
543 typedef typename Traits::BaseType Base;
544 typedef bslmf::MovableRefUtil MoveUtil;
545
546 /// `SelfType` is an alias to this class.
547 typedef VariantImp<TYPES> SelfType;
548
549 private:
550 // PRIVATE MANIPULATORS
551
552 /// Invoke `operator()` of the specified `visitor` on the current value
553 /// (of template parameter `TYPE`) held by this variant. `TYPE` must be
554 /// the same as one of the types that this variant can hold. The
555 /// behavior is undefined unless this variant holds a value of template
556 /// parameter `TYPE`. Note that the second argument is for resolving
557 /// overloading ambiguity and is not used.
558 template <class TYPE, class VISITOR_REF>
559 void applyImp(VISITOR_REF visitor, bsl::false_type);
560 template <class TYPE, class VISITOR_REF>
561 void applyImp(VISITOR_REF visitor, bsl::true_type);
562 template <class TYPE, class VISITOR_REF>
563 void applyImp(VISITOR_REF visitor);
564
565 /// Invoke `operator()` of the specified `visitor` on the current value
566 /// (of template parameter `TYPE`) held by this variant, and return the
567 /// value (of template parameter `RET_TYPE`) returned by the `visitor`.
568 /// `TYPE` must be the same as one of the types that this variant can
569 /// hold. The behavior is undefined unless this variant holds a value
570 /// of template parameter `TYPE`. Note that the second argument is for
571 /// resolving overloading ambiguity and is not used.
572 template <class TYPE, class VISITOR_REF, class RET_TYPE>
573 RET_TYPE applyImpR(VISITOR_REF visitor, bsl::false_type);
574 template <class TYPE, class VISITOR_REF, class RET_TYPE>
575 RET_TYPE applyImpR(VISITOR_REF visitor, bsl::true_type);
576 template <class TYPE, class VISITOR_REF, class RET_TYPE>
577 RET_TYPE applyImpR(VISITOR_REF visitor);
578
579 /// Assign to this variant the specified `value` of template parameter
580 /// `SOURCE_TYPE` converted to template parameter `TYPE`. `TYPE` must
581 /// be the same as one of the types that this variant can hold and
582 /// `SOURCE_TYPE` must be convertible to `TYPE`.
583 template <class TYPE, class SOURCE_TYPE>
584 void assignImp(const SOURCE_TYPE& value);
585
586 template <class TYPE>
587#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
588 void assignImp(TYPE&& value);
589#else
590 void assignImp(bslmf::MovableRef<TYPE> value);
591#endif
592 // Assign to this variant the specified 'value' of template parameter
593 // 'TYPE'. The contents of 'value' are moved to this object with
594 // 'value' left in a valid but unspecified state. 'TYPE' must be the
595 // same as one of the types that this variant can hold.
596
597 /// Construct this variant object to initially hold the specified
598 /// `value` of template parameter `TYPE`. `TYPE` must be the same as
599 /// one of the types that this variant can hold. Note that the second
600 /// parameter is for resolving overloading ambiguity and is not used.
601 template <class TYPE>
602 void create(const TYPE& value, bsl::false_type);
603
604 /// Construct this variant object to be initially in the unset state.
605 void create(bslma::Allocator *, bsl::true_type);
606
607 /// Apply the specified `visitor` on the current value held by this
608 /// variant by invoking `applyImp` with the appropriate template
609 /// arguments, determined by the specified `type`. The behavior is
610 /// undefined unless `type != 0`.
611 template <class VISITOR_REF>
612 void doApply(VISITOR_REF visitor, int type);
613
614 /// Apply the specified `visitor` on the current value held by this
615 /// variant by invoking `applyImpR` with the appropriate template
616 /// arguments, determined by the specified `type`, and return the value
617 /// (of template parameter `RET_TYPE`) returned by the `visitor`. The
618 /// behavior is undefined unless `type != 0`.
619 template <class VISITOR_REF, class RET_TYPE>
620 RET_TYPE doApplyR(VISITOR_REF visitor, int type);
621
622 // PRIVATE ACCESSORS
623
624 /// Invoke `operator()` of the specified `visitor` on the current value
625 /// (of template parameter `TYPE`) held by this variant. `TYPE` must be
626 /// the same as one of the types that this variant can hold. The
627 /// behavior is undefined unless this variant holds a value of template
628 /// parameter `TYPE`. Note that the second argument is for resolving
629 /// overloading ambiguity and is not used.
630 template <class TYPE, class VISITOR_REF>
631 void applyImp(VISITOR_REF visitor, bsl::false_type) const;
632 template <class TYPE, class VISITOR_REF>
633 void applyImp(VISITOR_REF visitor, bsl::true_type) const;
634 template <class TYPE, class VISITOR_REF>
635 void applyImp(VISITOR_REF visitor) const;
636
637 /// Invoke `operator()` of the specified `visitor` on the current value
638 /// (of template parameter `TYPE`) held by this variant, and return the
639 /// value (of template parameter `RET_TYPE`) returned by the `visitor`.
640 /// `TYPE` must be the same as one of the types that this variant can
641 /// hold. The behavior is undefined unless this variant holds a value
642 /// of template parameter `TYPE`. Note that the second argument is for
643 /// resolving overloading ambiguity and is not used.
644 template <class TYPE, class VISITOR_REF, class RET_TYPE>
645 RET_TYPE applyImpR(VISITOR_REF visitor, bsl::false_type) const;
646 template <class TYPE, class VISITOR_REF, class RET_TYPE>
647 RET_TYPE applyImpR(VISITOR_REF visitor, bsl::true_type) const;
648 template <class TYPE, class VISITOR_REF, class RET_TYPE>
649 RET_TYPE applyImpR(VISITOR_REF visitor) const;
650
651 /// Apply the specified `visitor` on the current value held by this
652 /// variant by invoking `applyImp` with the appropriate template
653 /// arguments, determined by the specified `type`. The behavior is
654 /// undefined unless `type != 0`.
655 template <class VISITOR_REF>
656 void doApply(VISITOR_REF visitor, int type) const;
657
658 /// Apply the specified `visitor` on the current value held by this
659 /// variant by invoking `applyImpR` with the appropriate template
660 /// arguments, determined by the specified `type`, and return the value
661 /// (of template parameter `RET_TYPE`) returned by the `visitor`. The
662 /// behavior is undefined unless `type != 0`.
663 template <class VISITOR_REF, class RET_TYPE>
664 RET_TYPE doApplyR(VISITOR_REF visitor, int type) const;
665
666 public:
667 // TRAITS
678
679 // CREATORS
680
681 /// Create a variant object in the unset state that uses the currently
682 /// installed default allocator to supply memory.
683 VariantImp();
684
685 /// Create a variant object with the specified `valueOrAllocator` that
686 /// can be either a value of a type that the variant can hold or an
687 /// allocator to supply memory. If `valueOrAllocator` is not a
688 /// `bslma::Allocator *`, then the variant will hold the value and type
689 /// of `valueOrAllocator`, and use the currently installed default
690 /// allocator to supply memory. Otherwise, the variant will be unset
691 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
692 /// must be the same as one of the types that this variant can hold or
693 /// be convertible to `bslma::Allocator *`. Note that this
694 /// parameterized constructor is defined instead of two constructors
695 /// (one taking a `bslma::Allocator *` and the other not) because
696 /// template parameter arguments are always a better match than
697 /// derived-to-base conversion (a concrete allocator pointer converted
698 /// to `bslma::Allocator *`).
699 template <class TYPE_OR_ALLOCATOR>
700 explicit
701 VariantImp(const TYPE_OR_ALLOCATOR& valueOrAllocator);
702
703 /// Create a variant object having the specified `value` of template
704 /// parameter `TYPE` and that uses the specified `basicAllocator` to
705 /// supply memory. If `basicAllocator` is 0, the currently installed
706 /// default allocator is used. `TYPE` must be the same as one of the
707 /// types that this variant can hold.
708 template <class TYPE>
709 VariantImp(const TYPE& value, bslma::Allocator *basicAllocator);
710
711 template <class TYPE>
712 explicit
713#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
714 VariantImp(TYPE&& value,
715 typename bsl::enable_if<
717 SelfType,
718 typename bsl::remove_const<
719 typename bsl::remove_reference<TYPE>::type>::type>::value
720 &&
722 void>::type * = 0);
723#else
725#endif
726 // Create a variant object having the specified 'value' of template
727 // parameter 'TYPE' by moving the contents of 'value' to the
728 // newly-created object. Use the currently installed default allocator
729 // to supply memory. 'value' is left in a valid but unspecified state.
730 // 'TYPE' must be the same as one of the types that this variant can
731 // hold. Note that in C++11 mode, this method does not participate in
732 // overload resolution if it would lead to ambiguity with the move
733 // constructor that does not take an allocator (below) or with the
734 // constructor taking a 'valueOrAllocator' (above).
735
736 template <class TYPE>
737#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
738 VariantImp(TYPE&& value,
739 typename bsl::enable_if<
741 SelfType,
742 typename bsl::remove_const<
743 typename bsl::remove_reference<TYPE>::type>::type>::value,
744 bslma::Allocator>::type *basicAllocator);
745#else
747 bslma::Allocator *basicAllocator);
748#endif
749 // Create a variant object having the specified 'value' of template
750 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
751 // memory. If 'basicAllocator' is 0, the currently installed default
752 // allocator is used. The contents of 'value' are moved to the
753 // newly-created object with 'value' left in a valid but unspecified
754 // state. 'TYPE' must be the same as one of the types that this
755 // variant can hold. Note that in C++11 mode, this method does not
756 // participate in overload resolution if it would lead to ambiguity
757 // with the move constructor that takes an allocator (below).
758
759 /// Create a variant object having the type and value of the specified
760 /// `original` variant. Optionally specify a `basicAllocator` used to
761 /// supply memory. If `basicAllocator` is 0, the currently installed
762 /// default allocator is used.
763 VariantImp(const VariantImp& original,
764 bslma::Allocator *basicAllocator = 0);
765
766 /// Create a variant object having the type and value of the specified
767 /// `original` object by moving the contents of `original` to the
768 /// newly-created object. The allocator associated with `original` (if
769 /// any) is propagated for use in the newly-created object. `original`
770 /// is left in a valid but unspecified state.
772
773 /// Create a variant object having the type and value of the specified
774 /// `original` object that uses the specified `basicAllocator` to supply
775 /// memory. If `basicAllocator` is 0, the currently installed default
776 /// allocator is used. The contents of `original` are moved to the
777 /// newly-created object with `original` left in a valid but unspecified
778 /// state.
780 bslma::Allocator *basicAllocator);
781
782 /// Destroy this variant object, invoking the destructor of the type of
783 /// object contained (if any) on the value of that type.
784 ~VariantImp();
785
786 // MANIPULATORS
787
788 /// Assign to this object the specified `value` of template parameter
789 /// `TYPE`, and return a reference providing modifiable access to this
790 /// object. The value currently held by this variant (if any) is
791 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
792 /// must be the same as one of the types that this variant can hold.
793 template <class TYPE>
794 VariantImp& operator=(const TYPE& value);
795
796 template <class TYPE>
797#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
798 typename bsl::enable_if<
799 !bsl::is_same<SelfType,
800 typename bsl::remove_cvref<TYPE>::type>::value,
801 SelfType>::type&
802 operator=(TYPE&& value);
803#else
806#endif
807 // Assign to this object the specified 'value' of template parameter
808 // 'TYPE', and return a reference providing modifiable access to this
809 // object. The contents of 'value' are moved to this object with
810 // 'value' left in a valid but unspecified state. The value currently
811 // held by this variant (if any) is destroyed if that value's type is
812 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
813 // that this variant can hold. Note that in C++11 mode, this method
814 // does not participate in overload resolution if it would lead to
815 // ambiguity with the move-assignment operator (below).
816
817 /// Assign to this object the type and value currently held by the
818 /// specified `rhs` object, and return a reference providing modifiable
819 /// access to this object. The value currently held by this variant
820 /// (if any) is destroyed if that value's type is not the same as the
821 /// type held by the `rhs` object.
822 VariantImp& operator=(const VariantImp& rhs);
823
824 /// Assign to this object the type and value currently held by the
825 /// specified `rhs` object, and return a reference providing modifiable
826 /// access to this object. The contents of `rhs` are either
827 /// move-inserted into or move-assigned to this object with `rhs` left
828 /// in a valid but unspecified state.
830
831 /// Apply the specified `visitor` to this modifiable variant by passing
832 /// the value this variant currently holds to the `visitor` object's
833 /// `operator()`, and return the value returned by the `visitor`. If
834 /// this variant is unset, a default constructed `bslmf::Nil` is passed
835 /// to the `visitor`. Note that this method is selected only if the
836 /// template parameter type `VISITOR` defines a `typedef` of
837 /// `ResultType` in its public interface. Also note that this method is
838 /// defined inline to work around a Windows compiler bug with SFINAE
839 /// functions.
840 template <class VISITOR>
842 typename VISITOR::ResultType>::type
843 apply(VISITOR& visitor) {
844
845 if (this->d_type) {
846 return doApplyR<VISITOR&,
847 typename VISITOR::ResultType>(visitor, this->d_type);
848 // RETURN
849 }
850
851 bslmf::Nil nil = bslmf::Nil();
852 return visitor(nil);
853 }
854
855 /// Apply the specified `visitor` to this modifiable variant by passing
856 /// the value this variant currently holds to the `visitor` object's
857 /// `operator()`, and return the value returned by the `visitor`. If
858 /// If this variant is unset, a default constructed `bslmf::Nil` is
859 /// passed to the `visitor`. Note that this method is selected only if
860 /// the template parameter type `VISITOR` defines a `typedef` of
861 /// `ResultType` in its public interface. Also note that this method is
862 /// defined inline to work around a Windows compiler bug with SFINAE
863 /// functions.
864 template <class VISITOR>
866 typename VISITOR::ResultType>::type
867 apply(const VISITOR& visitor) {
868
869 if (this->d_type) {
870 return doApplyR<const VISITOR&,
871 typename VISITOR::ResultType>(visitor, this->d_type);
872 // RETURN
873 }
874
875 bslmf::Nil nil = bslmf::Nil();
876 return visitor(nil);
877 }
878
879 /// Apply the specified `visitor` to this modifiable variant by passing
880 /// the value (of template parameter `TYPE`) this variant currently
881 /// holds to the `visitor` object's `operator()`, and return the value
882 /// returned by the `visitor`. If this variant is unset, the specified
883 /// `defaultValue` of template parameter `TYPE` is passed to the
884 /// `visitor`. `TYPE` must be the same as one of the types that this
885 /// variant can hold. The behavior is undefined unless this variant is
886 /// unset or holds a value of template parameter `TYPE`. Note that this
887 /// method is selected only if the template parameter type `VISITOR`
888 /// defines a `typedef` of `ResultType` in its public interface. Also
889 /// note that this method is defined inline to work around a Windows
890 /// compiler bug with SFINAE functions.
891 template <class VISITOR, class TYPE>
893 typename VISITOR::ResultType>::type
894 apply(VISITOR& visitor, const TYPE& defaultValue) {
895
896 if (this->d_type) {
897 return doApplyR<VISITOR&,
898 typename VISITOR::ResultType>(visitor, this->d_type);
899 // RETURN
900 }
901
902 return visitor(defaultValue);
903 }
904
905 /// Apply the specified `visitor` to this modifiable variant by passing
906 /// the value (of template parameter `TYPE`) this variant currently
907 /// holds to the `visitor` object's `operator()`, and return the value
908 /// returned by the `visitor`. If this variant is unset, the specified
909 /// `defaultValue` of template parameter `TYPE` is passed to the
910 /// `visitor`. `TYPE` must be the same as one of the types that this
911 /// variant can hold. The behavior is undefined unless this variant is
912 /// unset or holds a value of template parameter `TYPE`. Note that this
913 /// method is selected only if the template parameter type `VISITOR`
914 /// defines a `typedef` of `ResultType` in its public interface. Also
915 /// note that this method is defined inline to work around a Windows
916 /// compiler bug with SFINAE functions.
917 template <class VISITOR, class TYPE>
919 typename VISITOR::ResultType>::type
920 apply(const VISITOR& visitor, const TYPE& defaultValue) {
921
922 if (this->d_type) {
923 return doApplyR<const VISITOR&,
924 typename VISITOR::ResultType>(visitor, this->d_type);
925 // RETURN
926 }
927
928 return visitor(defaultValue);
929 }
930
931 /// Apply the specified `visitor` to this modifiable variant by passing
932 /// the value this variant currently holds to the `visitor` object's
933 /// `operator()`. This method does not return a value. If this variant
934 /// is unset, a default constructed `bslmf::Nil` is passed to the
935 /// `visitor`. Note that this method is selected only if the template
936 /// parameter type `VISITOR` does not define a `typedef` of `ResultType`
937 /// in its public interface. Also note that this method is defined
938 /// inline to work around a Windows compiler bug with SFINAE functions.
939 template <class VISITOR>
941 void>::type
942 apply(VISITOR& visitor) {
943
944 if (this->d_type) {
945 doApply<VISITOR&>(visitor, this->d_type);
946 return; // RETURN
947 }
948
949 bslmf::Nil nil = bslmf::Nil();
950 visitor(nil);
951 }
952
953 /// Apply the specified `visitor` to this modifiable variant by passing
954 /// the value this variant currently holds to the `visitor` object's
955 /// `operator()`. This method does not return a value. If this variant
956 /// is unset, a default constructed `bslmf::Nil` is passed to the
957 /// `visitor`. Note that this method is selected only if the template
958 /// parameter type `VISITOR` does not define a `typedef` of `ResultType`
959 /// in its public interface. Also note that this method is defined
960 /// inline to work around a Windows compiler bug with SFINAE functions.
961 template <class VISITOR>
963 void>::type
964 apply(const VISITOR& visitor) {
965
966 if (this->d_type) {
967 doApply<const VISITOR&>(visitor, this->d_type);
968 return; // RETURN
969 }
970
971 bslmf::Nil nil = bslmf::Nil();
972 visitor(nil);
973 }
974
975 /// Apply the specified `visitor` to this modifiable variant by passing
976 /// the value (of template parameter `TYPE`) this variant currently
977 /// holds to the `visitor` object's `operator()`. This method does not
978 /// return a value. If this variant is unset, the specified
979 /// `defaultValue` of template parameter `TYPE` is passed to the
980 /// `visitor`. `TYPE` must be the same as one of the types that this
981 /// variant can hold. The behavior is undefined unless this variant is
982 /// unset or holds a value of template parameter `TYPE`. Note that this
983 /// method is selected only if the template parameter type `VISITOR`
984 /// does not define a `typedef` of `ResultType` in its public interface.
985 /// Also note that this method is defined inline to work around a
986 /// Windows compiler bug with SFINAE functions.
987 template <class VISITOR, class TYPE>
989 void>::type
990 apply(VISITOR& visitor, const TYPE& defaultValue) {
991
992 if (this->d_type) {
993 doApply<VISITOR&>(visitor, this->d_type);
994 return; // RETURN
995 }
996
997 visitor(defaultValue);
998 }
999
1000 /// Apply the specified `visitor` to this modifiable variant by passing
1001 /// the value (of template parameter `TYPE`) this variant currently
1002 /// holds to the `visitor` object's `operator()`. This method does not
1003 /// return a value. If this variant is unset, the specified
1004 /// `defaultValue` of template parameter `TYPE` is passed to the
1005 /// `visitor`. `TYPE` must be the same as one of the types that this
1006 /// variant can hold. The behavior is undefined unless this variant is
1007 /// unset or holds a value of template parameter `TYPE`. Note that this
1008 /// method is selected only if the template parameter type `VISITOR`
1009 /// does not define a `typedef` of `ResultType` in its public interface.
1010 /// Also note that this method is defined inline to work around a
1011 /// Windows compiler bug with SFINAE functions.
1012 template <class VISITOR, class TYPE>
1014 void>::type
1015 apply(const VISITOR& visitor, const TYPE& defaultValue) {
1016
1017 if (this->d_type) {
1018 doApply<const VISITOR&>(visitor, this->d_type);
1019 return; // RETURN
1020 }
1021
1022 visitor(defaultValue);
1023 }
1024
1025 /// Apply the specified `visitor` to this modifiable variant by passing
1026 /// the value (of template parameter `TYPE`) this variant currently
1027 /// holds to the `visitor` object's `operator()`, and return the value
1028 /// (of template parameter `RET_TYPE`) returned by the `visitor`. If
1029 /// this variant is unset, a default constructed `bslmf::Nil` is passed
1030 /// to the `visitor`.
1031 template <class RET_TYPE, class VISITOR>
1032 RET_TYPE apply(VISITOR& visitor);
1033 template <class RET_TYPE, class VISITOR>
1034 RET_TYPE apply(const VISITOR& visitor);
1035
1036 /// Apply the specified `visitor` to this modifiable variant by passing
1037 /// the value (of template parameter `TYPE`) this variant currently
1038 /// holds to the `visitor` object's `operator()`, and return the value
1039 /// (of template parameter `RET_TYPE`) returned by the `visitor`. If
1040 /// this variant is unset, the specified `defaultValue` of template
1041 /// parameter `TYPE` is passed to the `visitor`. `TYPE` must be the
1042 /// same as one of the types that this variant can hold. The behavior
1043 /// is undefined unless this variant is unset or holds a value of
1044 /// template parameter `TYPE`.
1045 template <class RET_TYPE, class VISITOR, class TYPE>
1046 RET_TYPE apply(VISITOR& visitor, const TYPE& defaultValue);
1047 template <class RET_TYPE, class VISITOR, class TYPE>
1048 RET_TYPE apply(const VISITOR& visitor, const TYPE& defaultValue);
1049
1050 /// Apply the specified `visitor` to this modifiable variant by passing
1051 /// the value (of template parameter `TYPE`) this variant currently
1052 /// holds to the `visitor` object's `operator()`, and return the value
1053 /// returned by the `visitor`. The behavior is undefined if this
1054 /// variant is unset. Note that this method is selected only if the
1055 /// template parameter type `VISITOR` defines a `typedef` of
1056 /// `ResultType` in its public interface. Also note that this method is
1057 /// defined inline to work around a Windows compiler bug with SFINAE
1058 /// functions.
1059 template <class VISITOR>
1061 typename VISITOR::ResultType>::type
1062 applyRaw(VISITOR& visitor) {
1063
1064 typedef Variant_RawVisitorHelper<typename VISITOR::ResultType,
1065 VISITOR> Helper;
1066
1067 return doApplyR<const Helper&,
1068 typename VISITOR::ResultType>(Helper(&visitor),
1069 this->d_type);
1070 }
1071
1072 /// Apply the specified `visitor` to this modifiable variant by passing
1073 /// the value (of template parameter `TYPE`) this variant currently
1074 /// holds to the `visitor` object's `operator()`, and return the value
1075 /// returned by the `visitor`. The behavior is undefined if this
1076 /// variant is unset. Note that this method is selected only if the
1077 /// template parameter type `VISITOR` defines a `typedef` of
1078 /// `ResultType` in its public interface. Also note that this method is
1079 /// defined inline to work around a Windows compiler bug with SFINAE
1080 /// functions.
1081 template <class VISITOR>
1083 typename VISITOR::ResultType>::type
1084 applyRaw(const VISITOR& visitor) {
1085
1086 typedef Variant_RawVisitorHelper<typename VISITOR::ResultType,
1087 const VISITOR> Helper;
1088
1089 return doApplyR<const Helper&,
1090 typename VISITOR::ResultType>(Helper(&visitor),
1091 this->d_type);
1092 }
1093
1094 /// Apply the specified `visitor` to this modifiable variant by passing
1095 /// the value (of template parameter `TYPE`) this variant currently
1096 /// holds to the `visitor` object's `operator()`. This method does not
1097 /// return a value. The behavior is undefined if this variant is unset.
1098 /// Note that this method is selected only if the template parameter
1099 /// type `VISITOR` does not define a `typedef` of `ResultType` in its
1100 /// public interface. Also note that this method is defined inline to
1101 /// work around a Windows compiler bug with SFINAE functions.
1102 template <class VISITOR>
1104 void>::type
1105 applyRaw(VISITOR& visitor) {
1106
1107 typedef Variant_RawVisitorHelper<void, VISITOR> Helper;
1108
1109 doApply<const Helper&>(Helper(&visitor), this->d_type);
1110 }
1111
1112 /// Apply the specified `visitor` to this modifiable variant by passing
1113 /// the value (of template parameter `TYPE`) this variant currently
1114 /// holds to the `visitor` object's `operator()`. This method does not
1115 /// return a value. The behavior is undefined if this variant is unset.
1116 /// Note that this method is selected only if the template parameter
1117 /// type `VISITOR` does not define a `typedef` of `ResultType` in its
1118 /// public interface. Also note that this method is defined inline to
1119 /// work around a Windows compiler bug with SFINAE functions.
1120 template <class VISITOR>
1122 void>::type
1123 applyRaw(const VISITOR& visitor) {
1124
1125 typedef Variant_RawVisitorHelper<void, const VISITOR> Helper;
1126
1127 doApply<const Helper&>(Helper(&visitor), this->d_type);
1128 }
1129
1130 /// Apply the specified `visitor` to this modifiable variant by passing
1131 /// the value this variant currently holds to the `visitor` object's
1132 /// `operator()`, and return the value (of template parameter
1133 /// `RET_TYPE`) returned by the `visitor`. The behavior is undefined if
1134 /// this variant is unset.
1135 template <class RET_TYPE, class VISITOR>
1136 RET_TYPE applyRaw(VISITOR& visitor);
1137 template <class RET_TYPE, class VISITOR>
1138 RET_TYPE applyRaw(const VISITOR& visitor);
1139
1140 /// Assign to this object the specified `value` of template parameter
1141 /// `TYPE`, and return a reference providing modifiable access to this
1142 /// object. The value currently held by this variant (if any) is
1143 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
1144 /// must be the same as one of the types that this variant can hold.
1145 template <class TYPE>
1146 VariantImp& assign(const TYPE& value);
1147
1148 template <class TYPE>
1149#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
1150 VariantImp& assign(TYPE&& value);
1151#else
1153#endif
1154 // Assign to this object the specified 'value' of template parameter
1155 // 'TYPE', and return a reference providing modifiable access to this
1156 // object. The contents of 'value' are moved to this object with
1157 // 'value' left in a valid but unspecified state. The value currently
1158 // held by this variant (if any) is destroyed if that value's type is
1159 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
1160 // that this variant can hold.
1161
1162 /// Assign to this object the specified `value` of template parameter
1163 /// `SOURCE_TYPE` converted to template parameter `TYPE`, and return a
1164 /// reference providing modifiable access to this object. The value
1165 /// currently held by this variant (if any) is destroyed if that value's
1166 /// type is not the same as `TYPE`. `TYPE` must be the same as one of
1167 /// the types that this variant can hold and `SOURCE_TYPE` must be
1168 /// convertible to `TYPE`.
1169 template <class TYPE, class SOURCE_TYPE>
1170 VariantImp& assignTo(const SOURCE_TYPE& value);
1171
1172#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1173// {{{ BEGIN GENERATED CODE
1174// Command line: sim_cpp11_features.pl bdlb_variant.h
1175#ifndef BDLB_VARIANT_VARIADIC_LIMIT
1176#define BDLB_VARIANT_VARIADIC_LIMIT 14
1177#endif
1178#ifndef BDLB_VARIANT_VARIADIC_LIMIT_A
1179#define BDLB_VARIANT_VARIADIC_LIMIT_A BDLB_VARIANT_VARIADIC_LIMIT
1180#endif
1181
1182#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 0
1183 template <class TYPE>
1184 TYPE& createInPlace();
1185#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 0
1186
1187#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 1
1188 template <class TYPE, class ARGS_01>
1189 TYPE& createInPlace(
1190 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01);
1191#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 1
1192
1193#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 2
1194 template <class TYPE, class ARGS_01,
1195 class ARGS_02>
1196 TYPE& createInPlace(
1197 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1198 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02);
1199#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 2
1200
1201#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 3
1202 template <class TYPE, class ARGS_01,
1203 class ARGS_02,
1204 class ARGS_03>
1205 TYPE& createInPlace(
1206 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1207 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1208 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03);
1209#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 3
1210
1211#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 4
1212 template <class TYPE, class ARGS_01,
1213 class ARGS_02,
1214 class ARGS_03,
1215 class ARGS_04>
1216 TYPE& createInPlace(
1217 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1218 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1219 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1220 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04);
1221#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 4
1222
1223#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 5
1224 template <class TYPE, class ARGS_01,
1225 class ARGS_02,
1226 class ARGS_03,
1227 class ARGS_04,
1228 class ARGS_05>
1229 TYPE& createInPlace(
1230 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1231 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1232 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1233 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1234 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05);
1235#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 5
1236
1237#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 6
1238 template <class TYPE, class ARGS_01,
1239 class ARGS_02,
1240 class ARGS_03,
1241 class ARGS_04,
1242 class ARGS_05,
1243 class ARGS_06>
1244 TYPE& createInPlace(
1245 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1246 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1247 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1248 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1249 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1250 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06);
1251#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 6
1252
1253#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 7
1254 template <class TYPE, class ARGS_01,
1255 class ARGS_02,
1256 class ARGS_03,
1257 class ARGS_04,
1258 class ARGS_05,
1259 class ARGS_06,
1260 class ARGS_07>
1261 TYPE& createInPlace(
1262 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1263 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1264 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1265 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1266 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1267 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1268 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07);
1269#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 7
1270
1271#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 8
1272 template <class TYPE, class ARGS_01,
1273 class ARGS_02,
1274 class ARGS_03,
1275 class ARGS_04,
1276 class ARGS_05,
1277 class ARGS_06,
1278 class ARGS_07,
1279 class ARGS_08>
1280 TYPE& createInPlace(
1281 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1282 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1283 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1284 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1285 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1286 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1287 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1288 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08);
1289#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 8
1290
1291#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 9
1292 template <class TYPE, class ARGS_01,
1293 class ARGS_02,
1294 class ARGS_03,
1295 class ARGS_04,
1296 class ARGS_05,
1297 class ARGS_06,
1298 class ARGS_07,
1299 class ARGS_08,
1300 class ARGS_09>
1301 TYPE& createInPlace(
1302 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1303 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1304 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1305 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1306 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1307 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1308 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1309 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
1310 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09);
1311#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 9
1312
1313#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 10
1314 template <class TYPE, class ARGS_01,
1315 class ARGS_02,
1316 class ARGS_03,
1317 class ARGS_04,
1318 class ARGS_05,
1319 class ARGS_06,
1320 class ARGS_07,
1321 class ARGS_08,
1322 class ARGS_09,
1323 class ARGS_10>
1324 TYPE& createInPlace(
1325 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1326 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1327 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1328 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1329 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1330 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1331 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1332 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
1333 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
1334 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10);
1335#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 10
1336
1337#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 11
1338 template <class TYPE, class ARGS_01,
1339 class ARGS_02,
1340 class ARGS_03,
1341 class ARGS_04,
1342 class ARGS_05,
1343 class ARGS_06,
1344 class ARGS_07,
1345 class ARGS_08,
1346 class ARGS_09,
1347 class ARGS_10,
1348 class ARGS_11>
1349 TYPE& createInPlace(
1350 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1351 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1352 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1353 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1354 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1355 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1356 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1357 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
1358 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
1359 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
1360 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11);
1361#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 11
1362
1363#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 12
1364 template <class TYPE, class ARGS_01,
1365 class ARGS_02,
1366 class ARGS_03,
1367 class ARGS_04,
1368 class ARGS_05,
1369 class ARGS_06,
1370 class ARGS_07,
1371 class ARGS_08,
1372 class ARGS_09,
1373 class ARGS_10,
1374 class ARGS_11,
1375 class ARGS_12>
1376 TYPE& createInPlace(
1377 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1378 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1379 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1380 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1381 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1382 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1383 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1384 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
1385 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
1386 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
1387 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11,
1388 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) arguments_12);
1389#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 12
1390
1391#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 13
1392 template <class TYPE, class ARGS_01,
1393 class ARGS_02,
1394 class ARGS_03,
1395 class ARGS_04,
1396 class ARGS_05,
1397 class ARGS_06,
1398 class ARGS_07,
1399 class ARGS_08,
1400 class ARGS_09,
1401 class ARGS_10,
1402 class ARGS_11,
1403 class ARGS_12,
1404 class ARGS_13>
1405 TYPE& createInPlace(
1406 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1407 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1408 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1409 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1410 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1411 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1412 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1413 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
1414 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
1415 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
1416 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11,
1417 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) arguments_12,
1418 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) arguments_13);
1419#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 13
1420
1421#if BDLB_VARIANT_VARIADIC_LIMIT_A >= 14
1422 template <class TYPE, class ARGS_01,
1423 class ARGS_02,
1424 class ARGS_03,
1425 class ARGS_04,
1426 class ARGS_05,
1427 class ARGS_06,
1428 class ARGS_07,
1429 class ARGS_08,
1430 class ARGS_09,
1431 class ARGS_10,
1432 class ARGS_11,
1433 class ARGS_12,
1434 class ARGS_13,
1435 class ARGS_14>
1436 TYPE& createInPlace(
1437 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
1438 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
1439 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
1440 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
1441 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
1442 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
1443 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
1444 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
1445 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
1446 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
1447 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11,
1448 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) arguments_12,
1449 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) arguments_13,
1450 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) arguments_14);
1451#endif // BDLB_VARIANT_VARIADIC_LIMIT_A >= 14
1452
1453#else
1454// The generated code below is a workaround for the absence of perfect
1455// forwarding in some compilers.
1456
1457 template <class TYPE, class... ARGS>
1458 TYPE& createInPlace(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... arguments);
1459// }}} END GENERATED CODE
1460#endif
1461
1462 /// Destroy the current value held by this variant (if any), and reset
1463 /// this variant to the unset state.
1464 void reset();
1465
1466 /// Swap the value of this object with the value of the specified
1467 /// `other` object. This method provides the no-throw guarantee if the
1468 /// `TYPE` template parameter has a no-throw `swap` and the two variant
1469 /// objects being swapped have the same type; otherwise this method
1470 /// provides the basic guarantee.
1471 void swap(VariantImp& other);
1472
1473 /// Return a reference providing modifiable access to the value of
1474 /// template parameter `TYPE` held by this variant object. `TYPE` must
1475 /// be the same as one of the types that this variant can hold. The
1476 /// behavior is undefined unless `is<TYPE>()` returns `true` and `TYPE`
1477 /// is not `void`. Note that `TYPE` must be specified explicitly, e.g.,
1478 /// `myValue.the<int>()`.
1479 template <class TYPE>
1480 TYPE& the();
1481
1482 // ACCESSORS
1483
1484 /// Apply the specified `visitor` to this variant by passing the value
1485 /// this variant currently holds to the `visitor` object's `operator()`,
1486 /// and return the value returned by the `visitor`. If this variant is
1487 /// unset, a default constructed `bslmf::Nil` is passed to the
1488 /// `visitor`. Note that this method is selected only if the template
1489 /// parameter type `VISITOR` defines a `typedef` of `ResultType` in its
1490 /// public interface. Also note that this method is defined inline to
1491 /// work around a Windows compiler bug with SFINAE functions.
1492 template <class VISITOR>
1494 typename VISITOR::ResultType>::type
1495 apply(VISITOR& visitor) const {
1496
1497 if (this->d_type) {
1498 return doApplyR<VISITOR&,
1499 typename VISITOR::ResultType>(visitor, this->d_type);
1500 // RETURN
1501 }
1502
1503 bslmf::Nil nil = bslmf::Nil();
1504 return visitor(nil);
1505 }
1506
1507 /// Apply the specified `visitor` to this variant by passing the value
1508 /// this variant currently holds to the `visitor` object's `operator()`,
1509 /// and return the value returned by the 'visitor. If this variant is
1510 /// unset, a default constructed `bslmf::Nil` is passed to the
1511 /// `visitor`. Note that this method is selected only if the template
1512 /// parameter type `VISITOR` defines a `typedef` of `ResultType` in its
1513 /// public interface. Also note that this method is defined inline to
1514 /// work around a Windows compiler bug with SFINAE functions.
1515 template <class VISITOR>
1517 typename VISITOR::ResultType>::type
1518 apply(const VISITOR& visitor) const {
1519
1520 if (this->d_type) {
1521 return doApplyR<const VISITOR&,
1522 typename VISITOR::ResultType>(visitor, this->d_type);
1523 // RETURN
1524 }
1525
1526 bslmf::Nil nil = bslmf::Nil();
1527 return visitor(nil);
1528 }
1529
1530 /// Apply the specified `visitor` to this variant by passing the value
1531 /// (of template parameter `TYPE`) this variant currently holds to the
1532 /// `visitor` object's `operator()`, and return the value returned by
1533 /// the `visitor`. If this variant is unset, the specified
1534 /// `defaultValue` of template parameter `TYPE` is passed to the
1535 /// `visitor`. `TYPE` must be the same as one of the types that this
1536 /// variant can hold. The behavior is undefined unless this variant is
1537 /// unset or holds a value of template parameter `TYPE`. Note that this
1538 /// method is selected only if the template parameter type `VISITOR`
1539 /// defines a `typedef` of `ResultType` in its public interface. Also
1540 /// note that this method is defined inline to work around a Windows
1541 /// compiler bug with SFINAE functions.
1542 template <class VISITOR, class TYPE>
1544 typename VISITOR::ResultType>::type
1545 apply(VISITOR& visitor, const TYPE& defaultValue) const {
1546
1547 if (this->d_type) {
1548 return doApplyR<VISITOR&,
1549 typename VISITOR::ResultType>(visitor, this->d_type);
1550 // RETURN
1551 }
1552
1553 return visitor(defaultValue);
1554 }
1555
1556 /// Apply the specified `visitor` to this variant by passing the value
1557 /// (of template parameter `TYPE`) this variant currently holds to the
1558 /// `visitor` object's `operator()`, and return the value returned by
1559 /// the `visitor`. If this variant is unset, the specified
1560 /// `defaultValue` of template parameter `TYPE` is passed to the
1561 /// `visitor`. `TYPE` must be the same as one of the types that this
1562 /// variant can hold. The behavior is undefined unless this variant is
1563 /// unset or holds a value of template parameter `TYPE`. Note that this
1564 /// method is selected only if the template parameter type `VISITOR`
1565 /// defines a `typedef` of `ResultType` in its public interface. Also
1566 /// note that this method is defined inline to work around a Windows
1567 /// compiler bug with SFINAE functions.
1568 template <class VISITOR, class TYPE>
1570 typename VISITOR::ResultType>::type
1571 apply(const VISITOR& visitor, const TYPE& defaultValue) const {
1572
1573 if (this->d_type) {
1574 return doApplyR<const VISITOR&,
1575 typename VISITOR::ResultType>(visitor, this->d_type);
1576 // RETURN
1577 }
1578
1579 return visitor(defaultValue);
1580 }
1581
1582 /// Apply the specified `visitor` to this variant by passing the value
1583 /// this variant currently holds to the `visitor` object's `operator()`.
1584 /// This method does not return a value. If this variant is unset, a
1585 /// default constructed `bslmf::Nil` is passed to the `visitor`. Note
1586 /// that this method is selected only if the template parameter type
1587 /// `VISITOR` does not define a `typedef` of `ResultType` in its public
1588 /// interface. Also note that this method is defined inline to work
1589 /// around a Windows compiler bug with SFINAE functions.
1590 template <class VISITOR>
1592 void>::type
1593 apply(VISITOR& visitor) const {
1594
1595 if (this->d_type) {
1596 doApply<VISITOR&>(visitor, this->d_type);
1597 return; // RETURN
1598 }
1599
1600 bslmf::Nil nil = bslmf::Nil();
1601 visitor(nil);
1602 }
1603
1604 /// Apply the specified `visitor` to this variant by passing the value
1605 /// this variant currently holds to the `visitor` object's `operator()`.
1606 /// This method does not return a value. If this variant is unset, a
1607 /// default constructed `bslmf::Nil` is passed to the `visitor`. Note
1608 /// that this method is selected only if the template parameter type
1609 /// `VISITOR` does not define a `typedef` of `ResultType` in its public
1610 /// interface. Also note that this method is defined inline to work
1611 /// around a Windows compiler bug with SFINAE functions.
1612 template <class VISITOR>
1614 void>::type
1615 apply(const VISITOR& visitor) const {
1616
1617 if (this->d_type) {
1618 doApply<const VISITOR&>(visitor, this->d_type);
1619 return; // RETURN
1620 }
1621
1622 bslmf::Nil nil = bslmf::Nil();
1623 visitor(nil);
1624 }
1625
1626 /// Apply the specified `visitor` to this variant by passing the value
1627 /// (of template parameter `TYPE`) this variant currently holds to the
1628 /// `visitor` object's `operator()`. This method does not return a
1629 /// value. If this variant is unset, the specified `defaultValue` of
1630 /// template parameter `TYPE` is passed to the `visitor`. `TYPE` must
1631 /// be the same as one of the types that this variant can hold. The
1632 /// behavior is undefined unless this variant is unset or holds a value
1633 /// of template parameter `TYPE`. Note that this method is selected
1634 /// only if the template parameter type `VISITOR` does not define a
1635 /// `typedef` of `ResultType` in its public interface. Also note that
1636 /// this method is defined inline to work around a Windows compiler bug
1637 /// with SFINAE functions.
1638 template <class VISITOR, class TYPE>
1640 void>::type
1641 apply(VISITOR& visitor, const TYPE& defaultValue) const {
1642
1643 if (this->d_type) {
1644 doApply<VISITOR&>(visitor, this->d_type);
1645 return; // RETURN
1646 }
1647
1648 visitor(defaultValue);
1649 }
1650
1651 /// Apply the specified `visitor` to this variant by passing the value
1652 /// (of template parameter `TYPE`) this variant currently holds to the
1653 /// `visitor` object's `operator()`. This method does not return a
1654 /// value. If this variant is unset, the specified `defaultValue` of
1655 /// template parameter `TYPE` is passed to the `visitor`. `TYPE` must
1656 /// be the same as one of the types that this variant can hold. The
1657 /// behavior is undefined unless this variant is unset or holds a value
1658 /// of template parameter `TYPE`. Note that this method is selected
1659 /// only if the template parameter type `VISITOR` does not define a
1660 /// `typedef` of `ResultType` in its public interface. Also note that
1661 /// this method is defined inline to work around a Windows compiler bug
1662 /// with SFINAE functions.
1663 template <class VISITOR, class TYPE>
1665 void>::type
1666 apply(const VISITOR& visitor, const TYPE& defaultValue) const {
1667
1668 if (this->d_type) {
1669 doApply<const VISITOR&>(visitor, this->d_type);
1670 return; // RETURN
1671 }
1672
1673 visitor(defaultValue);
1674 }
1675
1676 /// Apply the specified `visitor` to this variant by passing the value
1677 /// this variant currently holds to the `visitor` object's `operator()`,
1678 /// and return the value (of template parameter `RET_TYPE`) returned by
1679 /// the `visitor`. If this variant is unset, a default constructed
1680 /// `bslmf::Nil` is passed to the `visitor`.
1681 template <class RET_TYPE, class VISITOR>
1682 RET_TYPE apply(VISITOR& visitor) const;
1683 template <class RET_TYPE, class VISITOR>
1684 RET_TYPE apply(const VISITOR& visitor) const;
1685
1686 /// Apply the specified `visitor` to this variant by passing the value
1687 /// (of template parameter `TYPE`) this variant currently holds to the
1688 /// `visitor` object's `operator()`, and return the value (of template
1689 /// parameter `RET_TYPE`) returned by the `visitor`. If this variant is
1690 /// unset, the specified `defaultValue` of template parameter `TYPE` is
1691 /// passed to the `visitor`. `TYPE` must be the same as one of the
1692 /// types that this variant can hold. The behavior is undefined unless
1693 /// this variant is unset or holds a value of template parameter `TYPE`.
1694 template <class RET_TYPE, class VISITOR, class TYPE>
1695 RET_TYPE apply(VISITOR& visitor, const TYPE& defaultValue) const;
1696 template <class RET_TYPE, class VISITOR, class TYPE>
1697 RET_TYPE apply(const VISITOR& visitor, const TYPE& defaultValue) const;
1698
1699 /// Apply the specified `visitor` to this variant by passing the value
1700 /// this variant currently holds to the `visitor` object's `operator()`,
1701 /// and return the value (of template parameter `RET_TYPE`) returned by
1702 /// the `visitor`. The behavior is undefined if this variant is unset.
1703 /// Note that this method is selected only if the template parameter
1704 /// type `VISITOR` defines a `typedef` of `ResultType` in its public
1705 /// interface. Also note that this method is defined inline to work
1706 /// around a Windows compiler bug with SFINAE functions.
1707 template <class VISITOR>
1709 typename VISITOR::ResultType>::type
1710 applyRaw(VISITOR& visitor) const {
1711
1712 typedef Variant_RawVisitorHelper<typename VISITOR::ResultType,
1713 VISITOR> Helper;
1714
1715 return doApplyR<const Helper&,
1716 typename VISITOR::ResultType>(Helper(&visitor),
1717 this->d_type);
1718 }
1719
1720 /// Apply the specified `visitor` to this variant by passing the value
1721 /// this variant currently holds to the `visitor` object's `operator()`,
1722 /// and return the value returned by the `visitor`. The behavior is
1723 /// undefined if this variant is unset. Note that this method is
1724 /// selected only if the template parameter type `VISITOR` defines a
1725 /// `typedef` of `ResultType` in its public interface. Also note that
1726 /// this method is defined inline to work around a Windows compiler bug
1727 /// with SFINAE functions.
1728 template <class VISITOR>
1730 typename VISITOR::ResultType>::type
1731 applyRaw(const VISITOR& visitor) const {
1732
1733 typedef Variant_RawVisitorHelper<typename VISITOR::ResultType,
1734 const VISITOR> Helper;
1735
1736 return doApplyR<const Helper&,
1737 typename VISITOR::ResultType>(Helper(&visitor),
1738 this->d_type);
1739 }
1740
1741 /// Apply the specified `visitor` to this variant by passing the value
1742 /// this variant currently holds to the `visitor` object's `operator()`.
1743 /// This method does not return a value. The behavior is undefined if
1744 /// this variant is unset. Note that this method is selected only if
1745 /// the template parameter type `VISITOR` does not define a `typedef` of
1746 /// `ResultType` in its public interface. Also note that this method is
1747 /// defined inline to work around a Windows compiler bug with SFINAE
1748 /// functions.
1749 template <class VISITOR>
1751 void>::type
1752 applyRaw(VISITOR& visitor) const {
1753
1754 typedef Variant_RawVisitorHelper<void, VISITOR> Helper;
1755
1756 return doApply<const Helper&>(Helper(&visitor), this->d_type);
1757 }
1758
1759 /// Apply the specified `visitor` to this variant by passing the value
1760 /// this variant currently holds to the `visitor` object's `operator()`.
1761 /// This method does not return a value. The behavior is undefined if
1762 /// this variant is unset. Note that this method is selected only if
1763 /// the template parameter type `VISITOR` does not define a `typedef` of
1764 /// `ResultType` in its public interface. Also note that this method is
1765 /// defined inline to work around a Windows compiler bug with SFINAE
1766 /// functions.
1767 template <class VISITOR>
1769 void>::type
1770 applyRaw(const VISITOR& visitor) const {
1771
1772 typedef Variant_RawVisitorHelper<void, const VISITOR> Helper;
1773
1774 return doApply<const Helper&>(Helper(&visitor), this->d_type);
1775 }
1776
1777 /// Apply the specified `visitor` to this variant by passing the value
1778 /// this variant currently holds to the `visitor` object's `operator()`,
1779 /// and return the value (of template parameter `RET_TYPE`) returned by
1780 /// the `visitor`. The behavior is undefined if this variant is unset.
1781 template <class RET_TYPE, class VISITOR>
1782 RET_TYPE applyRaw(VISITOR& visitor) const;
1783 template <class RET_TYPE, class VISITOR>
1784 RET_TYPE applyRaw(const VISITOR& visitor) const;
1785
1786 /// Return `true` if the value held by this variant object is of
1787 /// template parameter `TYPE`, and `false` otherwise. `TYPE` must be
1788 /// the same as one of the types that this variant can hold. Note that
1789 /// `TYPE` must be specified explicitly, e.g., `myValue.is<int>()`.
1790 template <class TYPE>
1791 bool is() const;
1792
1793 /// Return `true` if this variant is currently unset, and `false`
1794 /// otherwise. An unset variant does not hold a value or type. Note
1795 /// that this method should be preferred over checking the type index of
1796 /// the variant.
1797 bool isUnset() const;
1798
1799 /// Format this object to the specified output `stream` at the (absolute
1800 /// value of) the optionally specified indentation `level`, and return a
1801 /// reference to `stream`. If `level` is specified, optionally specify
1802 /// `spacesPerLevel`, the number of spaces per indentation level for
1803 /// this and all of its nested objects. If `level` is negative,
1804 /// suppress indentation of the first line. If `spacesPerLevel` is
1805 /// negative, format the entire output on one line, suppressing all but
1806 /// the initial indentation (as governed by `level`). If `stream` is
1807 /// not valid on entry, this operation has no effect. Nothing is
1808 /// printed if this variant is unset. Each type that may be contained
1809 /// by this variant shall be printable with `bdlb::PrintMethods`
1810 /// (typically meaning that they either declare the
1811 /// `bdlb::HasPrintMethod` trait or provide the `<<` output streaming
1812 /// operator). See @ref bdlb_printmethods . The compiler will emit an
1813 /// error if `bdlb::PrintMethods::print` cannot be instantiated for each
1814 /// type that may be contained by this variant.
1815 bsl::ostream& print(bsl::ostream& stream,
1816 int level = 0,
1817 int spacesPerLevel = 4) const;
1818
1819 /// Return a reference providing non-modifiable access to the value of
1820 /// template parameter `TYPE` held by this variant object. `TYPE` must
1821 /// be the same as one of the types that this variant can hold. The
1822 /// behavior is undefined unless `is<TYPE>()` returns `true` and `TYPE`
1823 /// is not `void`. Note that `TYPE` must be specified explicitly, e.g.,
1824 /// `myValue.the<int>()`.
1825 template <class TYPE>
1826 const TYPE& the() const;
1827
1828 /// Return the index in the list of `TYPES` corresponding to the type of
1829 /// the value currently held by this variant object (starting at 1), or
1830 /// 0 if this object is unset. Note that instead of switching code on
1831 /// the type index, calling `apply` is the preferred method of
1832 /// manipulating different types stored inside a variant.
1833 int typeIndex() const;
1834
1835#ifndef BDE_OMIT_INTERNAL_DEPRECATED
1836 /// Return `typeid(void)`.
1837 ///
1838 /// DEPRECATED: Do not use.
1839 const bsl::type_info& typeInfo() const;
1840
1841 /// DEPRECATED: Do not use.
1842 template <class STREAM>
1843 STREAM& bdexStreamIn(STREAM& stream, int version);
1844
1845 /// DEPRECATED: Do not use.
1846 int maxSupportedBdexVersion() const;
1847
1848 /// DEPRECATED: Do not use.
1849 template <class STREAM>
1850 STREAM& bdexStreamOut(STREAM& stream, int version) const;
1851
1852#endif // BDE_OMIT_INTERNAL_DEPRECATED
1853};
1854
1855// FREE OPERATORS
1856
1857/// Return `true` if the specified `lhs` variant object has the same value
1858/// as the specified `rhs` variant object, and `false` otherwise. Two
1859/// variant objects have the same value if they are both set and hold
1860/// objects of the same type and same value, or are both unset.
1861template <class TYPES>
1862bool operator==(const VariantImp<TYPES>& lhs,
1863 const VariantImp<TYPES>& rhs);
1864
1865/// Return `true` if the specified `lhs` variant object does not have the
1866/// same value as the specified `rhs` variant object, and `false` otherwise.
1867/// Two variant objects do not have the same value if one is set and the
1868/// other is unset, or if they are both set but hold objects that differ in
1869/// type or value.
1870template <class TYPES>
1871bool operator!=(const VariantImp<TYPES>& lhs,
1872 const VariantImp<TYPES>& rhs);
1873
1874/// Write the specified variant `object` to the specified output `stream` in
1875/// a single-line (human-readable) format, and return a reference to
1876/// `stream`.
1877template <class TYPES>
1878bsl::ostream& operator<<(bsl::ostream& stream,
1879 const VariantImp<TYPES>& object);
1880
1881// FREE FUNCTIONS
1882
1883/// Swap the values of the specified `a` and `b` objects. This method
1884/// provides the no-throw guarantee if the `TYPE` template parameter has a
1885/// no-throw `swap` and the two variant objects being swapped has the same
1886/// type; otherwise this method provides the basic guarantee.
1887template <class TYPES>
1888void swap(VariantImp<TYPES>& a, VariantImp<TYPES>& b);
1889
1890 // ==================
1891 // class Variant<...>
1892 // ==================
1893
1894#if defined(BDLB_VARIANT_USING_VARIADIC_TEMPLATES)
1895template <class ...TYPES>
1896class Variant : public VariantImp<typename bslmf::TypeList<TYPES...>::ListType>
1897 {
1898#else
1899template <class A1 = bslmf::Nil, class A2 = bslmf::Nil,
1900 class A3 = bslmf::Nil, class A4 = bslmf::Nil,
1901 class A5 = bslmf::Nil, class A6 = bslmf::Nil,
1902 class A7 = bslmf::Nil, class A8 = bslmf::Nil,
1903 class A9 = bslmf::Nil, class A10 = bslmf::Nil,
1904 class A11 = bslmf::Nil, class A12 = bslmf::Nil,
1905 class A13 = bslmf::Nil, class A14 = bslmf::Nil,
1906 class A15 = bslmf::Nil, class A16 = bslmf::Nil,
1907 class A17 = bslmf::Nil, class A18 = bslmf::Nil,
1908 class A19 = bslmf::Nil, class A20 = bslmf::Nil>
1909class Variant : public VariantImp<typename bslmf::TypeList<
1910 A1, A2, A3, A4, A5,
1911 A6, A7, A8, A9, A10,
1912 A11, A12, A13, A14, A15,
1913 A16, A17, A18, A19, A20>::ListType> {
1914#endif
1915 // This class provides a "variant" type, i.e., a type capable of storing
1916 // values from a list of template parameter types 'A1' to 'A20'. Note that
1917 // if the number 'N' of types is smaller than 20, 'AN+1' up to 'A20'
1918 // default to 'bslmf::Nil', but it is more economical to use 'VariantN',
1919 // which accepts exactly 'N' template arguments, as this leads to shorter
1920 // symbols and debug string information.
1921
1922 // PRIVATE TYPES
1923#if defined(BDLB_VARIANT_USING_VARIADIC_TEMPLATES)
1924 typedef VariantImp<typename bslmf::TypeList<TYPES...>::ListType> Imp;
1925
1926 /// `SelfType` is an alias to this class.
1927 typedef Variant<TYPES...> SelfType;
1928#else
1929 typedef VariantImp<typename bslmf::TypeList<A1, A2, A3, A4, A5, A6,
1930 A7, A8, A9, A10, A11, A12,
1931 A13, A14, A15, A16, A17, A18,
1932 A19, A20>::ListType> Imp;
1933
1934 typedef Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
1935 A11, A12, A13, A14, A15, A16, A17, A18, A19, A20> SelfType;
1936 // 'SelfType' is an alias to this class.
1937#endif
1938
1939 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
1940 typedef bslmf::MovableRefUtil MoveUtil;
1941
1942 public:
1943 // TRAITS
1953 BSLMF_NESTED_TRAIT_DECLARATION(Variant, HasPrintMethod);
1954
1955 // CREATORS
1956
1957 /// Create a variant object in the unset state that uses the currently
1958 /// installed default allocator to supply memory.
1959 Variant();
1960
1961 /// Create a variant object with the specified `valueOrAllocator` that
1962 /// can be either a value of a type that the variant can hold or an
1963 /// allocator to supply memory. If `valueOrAllocator` is not a
1964 /// `bslma::Allocator *`, then the variant will hold the value and type
1965 /// of `valueOrAllocator`, and use the currently installed default
1966 /// allocator to supply memory. Otherwise, the variant will be unset
1967 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
1968 /// must be the same as one of the types that this variant can hold or
1969 /// be convertible to `bslma::Allocator *`. Note that this
1970 /// parameterized constructor is defined instead of two constructors
1971 /// (one taking a `bslma::Allocator *` and the other not) because
1972 /// template parameter arguments are always a better match than
1973 /// derived-to-base conversion (a concrete allocator pointer converted
1974 /// to `bslma::Allocator *`).
1975 template <class TYPE_OR_ALLOCATOR>
1976 explicit
1977 Variant(const TYPE_OR_ALLOCATOR& valueOrAllocator);
1978
1979 /// Create a variant object having the specified `value` of template
1980 /// parameter `TYPE` and that uses the specified `basicAllocator` to
1981 /// supply memory. If `basicAllocator` is 0, the currently installed
1982 /// default allocator is used. `TYPE` must be the same as one of the
1983 /// types that this variant can hold.
1984 template <class TYPE>
1985 Variant(const TYPE& value, bslma::Allocator *basicAllocator);
1986
1987 template <class TYPE>
1988 explicit
1989#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
1990 Variant(TYPE&& value,
1991 typename bsl::enable_if<
1992 !bsl::is_same<
1993 SelfType,
1994 typename bsl::remove_const<
1995 typename bsl::remove_reference<TYPE>::type>::type>::value
1996 &&
1998 void>::type * = 0);
1999#else
2001#endif
2002 // Create a variant object having the specified 'value' of template
2003 // parameter 'TYPE' by moving the contents of 'value' to the
2004 // newly-created object. Use the currently installed default allocator
2005 // to supply memory. 'value' is left in a valid but unspecified state.
2006 // 'TYPE' must be the same as one of the types that this variant can
2007 // hold. Note that in C++11 mode, this method does not participate in
2008 // overload resolution if it would lead to ambiguity with the move
2009 // constructor that does not take an allocator (below) or with the
2010 // constructor taking a 'valueOrAllocator' (above).
2011
2012 template <class TYPE>
2013#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2014 Variant(TYPE&& value,
2015 typename bsl::enable_if<
2016 !bsl::is_same<
2017 SelfType,
2018 typename bsl::remove_const<
2019 typename bsl::remove_reference<TYPE>::type>::type>::value,
2020 bslma::Allocator>::type *basicAllocator);
2021#else
2023 bslma::Allocator *basicAllocator);
2024#endif
2025 // Create a variant object having the specified 'value' of template
2026 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
2027 // memory. If 'basicAllocator' is 0, the currently installed default
2028 // allocator is used. The contents of 'value' are moved to the
2029 // newly-created object with 'value' left in a valid but unspecified
2030 // state. 'TYPE' must be the same as one of the types that this
2031 // variant can hold. Note that in C++11 mode, this method does not
2032 // participate in overload resolution if it would lead to ambiguity
2033 // with the move constructor that takes an allocator (below).
2034
2035 /// Create a variant object having the type and value of the specified
2036 /// `original` variant. Optionally specify a `basicAllocator` used to
2037 /// supply memory. If `basicAllocator` is 0, the currently installed
2038 /// default allocator is used.
2039 Variant(const Variant& original, bslma::Allocator *basicAllocator = 0);
2040
2041 /// Create a variant object having the type and value of the specified
2042 /// `original` object by moving the contents of `original` to the
2043 /// newly-created object. The allocator associated with `original` (if
2044 /// any) is propagated for use in the newly-created object. `original`
2045 /// is left in a valid but unspecified state.
2047
2048 /// Create a variant object having the type and value of the specified
2049 /// `original` object that uses the specified `basicAllocator` to supply
2050 /// memory. If `basicAllocator` is 0, the currently installed default
2051 /// allocator is used. The contents of `original` are moved to the
2052 /// newly-created object with `original` left in a valid but unspecified
2053 /// state.
2055 bslma::Allocator *basicAllocator);
2056
2057 // MANIPULATORS
2058
2059 /// Assign to this object the specified `value` of template parameter
2060 /// `TYPE`, and return a reference providing modifiable access to this
2061 /// object. The value currently held by this variant (if any) is
2062 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
2063 /// must be the same as one of the types that this variant can hold.
2064 template <class TYPE>
2065 Variant& operator=(const TYPE& value);
2066
2067 template <class TYPE>
2068#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2069 typename bsl::enable_if<
2070 !bsl::is_same<SelfType,
2071 typename bsl::remove_cvref<TYPE>::type>::value,
2072 SelfType>::type&
2073 operator=(TYPE&& value);
2074#else
2075 Variant&
2077#endif
2078 // Assign to this object the specified 'value' of template parameter
2079 // 'TYPE', and return a reference providing modifiable access to this
2080 // object. The contents of 'value' are moved to this object with
2081 // 'value' left in a valid but unspecified state. The value currently
2082 // held by this variant (if any) is destroyed if that value's type is
2083 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
2084 // that this variant can hold. Note that in C++11 mode, this method
2085 // does not participate in overload resolution if it would lead to
2086 // ambiguity with the move-assignment operator (below).
2087
2088 /// Assign to this object the type and value currently held by the
2089 /// specified `rhs` object, and return a reference providing modifiable
2090 /// access to this object. The value currently held by this variant
2091 /// (if any) is destroyed if that value's type is not the same as the
2092 /// type held by the `rhs` object.
2093 Variant& operator=(const Variant& rhs);
2094
2095 /// Assign to this object the type and value currently held by the
2096 /// specified `rhs` object, and return a reference providing modifiable
2097 /// access to this object. The value currently held by this variant
2098 /// (if any) is destroyed if that value's type is not the same as the
2099 /// type held by the `rhs` object. The contents of `rhs` are either
2100 /// move-inserted into or move-assigned to this object with `rhs` left
2101 /// in a valid but unspecified state.
2103};
2104
2105 // ===================
2106 // class Variant2<...>
2107 // ===================
2108
2109/// This class is a "specialization" of `Variant` for a fixed number (2) of
2110/// types. Its 2 template arguments *must* all be specified (none are
2111/// defaulted to `bslmf::Nil`). It provides the same functionality as
2112/// `Variant<A1, A2>`.
2113template <class A1, class A2>
2114class Variant2 : public VariantImp<typename bslmf::TypeList2<
2115 A1, A2>::ListType> {
2116
2117 // PRIVATE TYPES
2118 typedef VariantImp<typename bslmf::TypeList2<A1, A2>::ListType> Imp;
2119
2120 /// `SelfType` is an alias to this class.
2121 typedef Variant2<A1, A2> SelfType;
2122
2123 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
2124 typedef bslmf::MovableRefUtil MoveUtil;
2125
2126 public:
2127 // TRAITS
2130 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
2133 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
2136 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
2137 BSLMF_NESTED_TRAIT_DECLARATION(Variant2, HasPrintMethod);
2138
2139 // CREATORS
2140
2141 /// Create a variant object in the unset state that uses the currently
2142 /// installed default allocator to supply memory.
2143 Variant2();
2144
2145 /// Create a variant object with the specified `valueOrAllocator` that
2146 /// can be either a value of a type that the variant can hold or an
2147 /// allocator to supply memory. If `valueOrAllocator` is not a
2148 /// `bslma::Allocator *`, then the variant will hold the value and type
2149 /// of `valueOrAllocator`, and use the currently installed default
2150 /// allocator to supply memory. Otherwise, the variant will be unset
2151 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
2152 /// must be the same as one of the types that this variant can hold or
2153 /// be convertible to `bslma::Allocator *`. Note that this
2154 /// parameterized constructor is defined instead of two constructors
2155 /// (one taking a `bslma::Allocator *` and the other not) because
2156 /// template parameter arguments are always a better match than
2157 /// derived-to-base conversion (a concrete allocator pointer converted
2158 /// to `bslma::Allocator *`).
2159 template <class TYPE_OR_ALLOCATOR>
2160 explicit
2161 Variant2(const TYPE_OR_ALLOCATOR& valueOrAllocator);
2162
2163 /// Create a variant object having the specified `value` of template
2164 /// parameter `TYPE` and that uses the specified `basicAllocator` to
2165 /// supply memory. If `basicAllocator` is 0, the currently installed
2166 /// default allocator is used. `TYPE` must be the same as one of the
2167 /// types that this variant can hold.
2168 template <class TYPE>
2169 Variant2(const TYPE& value, bslma::Allocator *basicAllocator);
2170
2171 template <class TYPE>
2172 explicit
2173#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2174 Variant2(TYPE&& value,
2175 typename bsl::enable_if<
2176 !bsl::is_same<
2177 SelfType,
2178 typename bsl::remove_const<
2179 typename bsl::remove_reference<TYPE>::type>::type>::value
2180 &&
2182 void>::type * = 0);
2183#else
2184 Variant2(bslmf::MovableRef<TYPE> value);
2185#endif
2186 // Create a variant object having the specified 'value' of template
2187 // parameter 'TYPE' by moving the contents of 'value' to the
2188 // newly-created object. Use the currently installed default allocator
2189 // to supply memory. 'value' is left in a valid but unspecified state.
2190 // 'TYPE' must be the same as one of the types that this variant can
2191 // hold. Note that in C++11 mode, this method does not participate in
2192 // overload resolution if it would lead to ambiguity with the move
2193 // constructor that does not take an allocator (below) or with the
2194 // constructor taking a 'valueOrAllocator' (above).
2195
2196 template <class TYPE>
2197#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2198 Variant2(TYPE&& value,
2199 typename bsl::enable_if<
2200 !bsl::is_same<
2201 SelfType,
2202 typename bsl::remove_const<
2203 typename bsl::remove_reference<TYPE>::type>::type>::value,
2204 bslma::Allocator>::type *basicAllocator);
2205#else
2206 Variant2(bslmf::MovableRef<TYPE> value,
2207 bslma::Allocator *basicAllocator);
2208#endif
2209 // Create a variant object having the specified 'value' of template
2210 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
2211 // memory. If 'basicAllocator' is 0, the currently installed default
2212 // allocator is used. The contents of 'value' are moved to the
2213 // newly-created object with 'value' left in a valid but unspecified
2214 // state. 'TYPE' must be the same as one of the types that this
2215 // variant can hold. Note that in C++11 mode, this method does not
2216 // participate in overload resolution if it would lead to ambiguity
2217 // with the move constructor that takes an allocator (below).
2218
2219 /// Create a variant object having the type and value of the specified
2220 /// `original` variant. Optionally specify a `basicAllocator` used to
2221 /// supply memory. If `basicAllocator` is 0, the currently installed
2222 /// default allocator is used.
2223 Variant2(const Variant2& original, bslma::Allocator *basicAllocator = 0);
2224
2225 /// Create a variant object having the type and value of the specified
2226 /// `original` object by moving the contents of `original` to the
2227 /// newly-created object. The allocator associated with `original` (if
2228 /// any) is propagated for use in the newly-created object. `original`
2229 /// is left in a valid but unspecified state.
2230 Variant2(bslmf::MovableRef<Variant2> original);
2231
2232 /// Create a variant object having the type and value of the specified
2233 /// `original` object that uses the specified `basicAllocator` to supply
2234 /// memory. If `basicAllocator` is 0, the currently installed default
2235 /// allocator is used. The contents of `original` are moved to the
2236 /// newly-created object with `original` left in a valid but unspecified
2237 /// state.
2238 Variant2(bslmf::MovableRef<Variant2> original,
2239 bslma::Allocator *basicAllocator);
2240
2241 // MANIPULATORS
2242
2243 /// Assign to this object the specified `value` of template parameter
2244 /// `TYPE`, and return a reference providing modifiable access to this
2245 /// object. The value currently held by this variant (if any) is
2246 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
2247 /// must be the same as one of the types that this variant can hold.
2248 template <class TYPE>
2249 Variant2& operator=(const TYPE& value);
2250
2251 template <class TYPE>
2252#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2253 typename bsl::enable_if<
2254 !bsl::is_same<SelfType,
2255 typename bsl::remove_cvref<TYPE>::type>::value,
2256 SelfType>::type&
2257 operator=(TYPE&& value);
2258#else
2259 Variant2&
2260 operator=(bslmf::MovableRef<TYPE> value);
2261#endif
2262 // Assign to this object the specified 'value' of template parameter
2263 // 'TYPE', and return a reference providing modifiable access to this
2264 // object. The contents of 'value' are moved to this object with
2265 // 'value' left in a valid but unspecified state. The value currently
2266 // held by this variant (if any) is destroyed if that value's type is
2267 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
2268 // that this variant can hold. Note that in C++11 mode, this method
2269 // does not participate in overload resolution if it would lead to
2270 // ambiguity with the move-assignment operator (below).
2271
2272 /// Assign to this object the type and value currently held by the
2273 /// specified `rhs` object, and return a reference providing modifiable
2274 /// access to this object. The value currently held by this variant
2275 /// (if any) is destroyed if that value's type is not the same as the
2276 /// type held by the `rhs` object.
2277 Variant2& operator=(const Variant2& rhs);
2278
2279 /// Assign to this object the type and value currently held by the
2280 /// specified `rhs` object, and return a reference providing modifiable
2281 /// access to this object. The value currently held by this variant
2282 /// (if any) is destroyed if that value's type is not the same as the
2283 /// type held by the `rhs` object. The contents of `rhs` are either
2284 /// move-inserted into or move-assigned to this object with `rhs` left
2285 /// in a valid but unspecified state.
2286 Variant2& operator=(bslmf::MovableRef<Variant2> rhs);
2287};
2288
2289 // ===================
2290 // class Variant3<...>
2291 // ===================
2292
2293/// This class is a "specialization" of `Variant` for a fixed number (3) of
2294/// types. Its 3 template arguments *must* all be specified (none are
2295/// defaulted to `bslmf::Nil`). It provides the same functionality as
2296/// `Variant<A1, A2, A3>`.
2297template <class A1, class A2, class A3>
2298class Variant3 : public VariantImp<typename bslmf::TypeList3<
2299 A1, A2, A3>::ListType> {
2300
2301 // PRIVATE TYPES
2302 typedef VariantImp<typename bslmf::TypeList3<A1, A2,
2303 A3>::ListType> Imp;
2304
2305 /// `SelfType` is an alias to this class.
2306 typedef Variant3<A1, A2, A3> SelfType;
2307
2308 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
2309 typedef bslmf::MovableRefUtil MoveUtil;
2310
2311 public:
2312 // TRAITS
2315 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
2318 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
2321 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
2322 BSLMF_NESTED_TRAIT_DECLARATION(Variant3, HasPrintMethod);
2323
2324 // CREATORS
2325
2326 /// Create a variant object in the unset state that uses the currently
2327 /// installed default allocator to supply memory.
2328 Variant3();
2329
2330 /// Create a variant object with the specified `valueOrAllocator` that
2331 /// can be either a value of a type that the variant can hold or an
2332 /// allocator to supply memory. If `valueOrAllocator` is not a
2333 /// `bslma::Allocator *`, then the variant will hold the value and type
2334 /// of `valueOrAllocator`, and use the currently installed default
2335 /// allocator to supply memory. Otherwise, the variant will be unset
2336 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
2337 /// must be the same as one of the types that this variant can hold or
2338 /// be convertible to `bslma::Allocator *`. Note that this
2339 /// parameterized constructor is defined instead of two constructors
2340 /// (one taking a `bslma::Allocator *` and the other not) because
2341 /// template parameter arguments are always a better match than
2342 /// derived-to-base conversion (a concrete allocator pointer converted
2343 /// to `bslma::Allocator *`).
2344 template <class TYPE_OR_ALLOCATOR>
2345 explicit
2346 Variant3(const TYPE_OR_ALLOCATOR& valueOrAllocator);
2347
2348 /// Create a variant object having the specified `value` of template
2349 /// parameter `TYPE` and that uses the specified `basicAllocator` to
2350 /// supply memory. If `basicAllocator` is 0, the currently installed
2351 /// default allocator is used. `TYPE` must be the same as one of the
2352 /// types that this variant can hold.
2353 template <class TYPE>
2354 Variant3(const TYPE& value, bslma::Allocator *basicAllocator);
2355
2356 template <class TYPE>
2357 explicit
2358#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2359 Variant3(TYPE&& value,
2360 typename bsl::enable_if<
2361 !bsl::is_same<
2362 SelfType,
2363 typename bsl::remove_const<
2364 typename bsl::remove_reference<TYPE>::type>::type>::value
2365 &&
2367 void>::type * = 0);
2368#else
2369 Variant3(bslmf::MovableRef<TYPE> value);
2370#endif
2371 // Create a variant object having the specified 'value' of template
2372 // parameter 'TYPE' by moving the contents of 'value' to the
2373 // newly-created object. Use the currently installed default allocator
2374 // to supply memory. 'value' is left in a valid but unspecified state.
2375 // 'TYPE' must be the same as one of the types that this variant can
2376 // hold. Note that in C++11 mode, this method does not participate in
2377 // overload resolution if it would lead to ambiguity with the move
2378 // constructor that does not take an allocator (below) or with the
2379 // constructor taking a 'valueOrAllocator' (above).
2380
2381 template <class TYPE>
2382#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2383 Variant3(TYPE&& value,
2384 typename bsl::enable_if<
2385 !bsl::is_same<
2386 SelfType,
2387 typename bsl::remove_const<
2388 typename bsl::remove_reference<TYPE>::type>::type>::value,
2389 bslma::Allocator>::type *basicAllocator);
2390#else
2391 Variant3(bslmf::MovableRef<TYPE> value,
2392 bslma::Allocator *basicAllocator);
2393#endif
2394 // Create a variant object having the specified 'value' of template
2395 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
2396 // memory. If 'basicAllocator' is 0, the currently installed default
2397 // allocator is used. The contents of 'value' are moved to the
2398 // newly-created object with 'value' left in a valid but unspecified
2399 // state. 'TYPE' must be the same as one of the types that this
2400 // variant can hold. Note that in C++11 mode, this method does not
2401 // participate in overload resolution if it would lead to ambiguity
2402 // with the move constructor that takes an allocator (below).
2403
2404 /// Create a variant object having the type and value of the specified
2405 /// `original` variant. Optionally specify a `basicAllocator` used to
2406 /// supply memory. If `basicAllocator` is 0, the currently installed
2407 /// default allocator is used.
2408 Variant3(const Variant3& original, bslma::Allocator *basicAllocator = 0);
2409
2410 /// Create a variant object having the type and value of the specified
2411 /// `original` object by moving the contents of `original` to the
2412 /// newly-created object. The allocator associated with `original` (if
2413 /// any) is propagated for use in the newly-created object. `original`
2414 /// is left in a valid but unspecified state.
2415 Variant3(bslmf::MovableRef<Variant3> original);
2416
2417 /// Create a variant object having the type and value of the specified
2418 /// `original` object that uses the specified `basicAllocator` to supply
2419 /// memory. If `basicAllocator` is 0, the currently installed default
2420 /// allocator is used. The contents of `original` are moved to the
2421 /// newly-created object with `original` left in a valid but unspecified
2422 /// state.
2423 Variant3(bslmf::MovableRef<Variant3> original,
2424 bslma::Allocator *basicAllocator);
2425
2426 // MANIPULATORS
2427
2428 /// Assign to this object the specified `value` of template parameter
2429 /// `TYPE`, and return a reference providing modifiable access to this
2430 /// object. The value currently held by this variant (if any) is
2431 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
2432 /// must be the same as one of the types that this variant can hold.
2433 template <class TYPE>
2434 Variant3& operator=(const TYPE& value);
2435
2436 template <class TYPE>
2437#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2438 typename bsl::enable_if<
2439 !bsl::is_same<SelfType,
2440 typename bsl::remove_cvref<TYPE>::type>::value,
2441 SelfType>::type&
2442 operator=(TYPE&& value);
2443#else
2444 Variant3&
2445 operator=(bslmf::MovableRef<TYPE> value);
2446#endif
2447 // Assign to this object the specified 'value' of template parameter
2448 // 'TYPE', and return a reference providing modifiable access to this
2449 // object. The contents of 'value' are moved to this object with
2450 // 'value' left in a valid but unspecified state. The value currently
2451 // held by this variant (if any) is destroyed if that value's type is
2452 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
2453 // that this variant can hold. Note that in C++11 mode, this method
2454 // does not participate in overload resolution if it would lead to
2455 // ambiguity with the move-assignment operator (below).
2456
2457 /// Assign to this object the type and value currently held by the
2458 /// specified `rhs` object, and return a reference providing modifiable
2459 /// access to this object. The value currently held by this variant
2460 /// (if any) is destroyed if that value's type is not the same as the
2461 /// type held by the `rhs` object.
2462 Variant3& operator=(const Variant3& rhs);
2463
2464 /// Assign to this object the type and value currently held by the
2465 /// specified `rhs` object, and return a reference providing modifiable
2466 /// access to this object. The value currently held by this variant
2467 /// (if any) is destroyed if that value's type is not the same as the
2468 /// type held by the `rhs` object. The contents of `rhs` are either
2469 /// move-inserted into or move-assigned to this object with `rhs` left
2470 /// in a valid but unspecified state.
2471 Variant3& operator=(bslmf::MovableRef<Variant3> rhs);
2472};
2473
2474 // ===================
2475 // class Variant4<...>
2476 // ===================
2477
2478/// This class is a "specialization" of `Variant` for a fixed number (4) of
2479/// types. Its 4 template arguments *must* all be specified (none are
2480/// defaulted to `bslmf::Nil`). It provides the same functionality as
2481/// `Variant<A1, A2, ..., A4>`.
2482template <class A1, class A2, class A3, class A4>
2483class Variant4 : public VariantImp<typename bslmf::TypeList4<
2484 A1, A2, A3, A4>::ListType> {
2485
2486 // PRIVATE TYPES
2487 typedef VariantImp<typename bslmf::TypeList4<A1, A2, A3,
2488 A4>::ListType> Imp;
2489
2490 /// `SelfType` is an alias to this class.
2491 typedef Variant4<A1, A2, A3, A4> SelfType;
2492
2493 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
2494 typedef bslmf::MovableRefUtil MoveUtil;
2495
2496 public:
2497 // TRAITS
2500 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
2503 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
2506 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
2507 BSLMF_NESTED_TRAIT_DECLARATION(Variant4, HasPrintMethod);
2508
2509 // CREATORS
2510
2511 /// Create a variant object in the unset state that uses the currently
2512 /// installed default allocator to supply memory.
2513 Variant4();
2514
2515 /// Create a variant object with the specified `valueOrAllocator` that
2516 /// can be either a value of a type that the variant can hold or an
2517 /// allocator to supply memory. If `valueOrAllocator` is not a
2518 /// `bslma::Allocator *`, then the variant will hold the value and type
2519 /// of `valueOrAllocator`, and use the currently installed default
2520 /// allocator to supply memory. Otherwise, the variant will be unset
2521 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
2522 /// must be the same as one of the types that this variant can hold or
2523 /// be convertible to `bslma::Allocator *`. Note that this
2524 /// parameterized constructor is defined instead of two constructors
2525 /// (one taking a `bslma::Allocator *` and the other not) because
2526 /// template parameter arguments are always a better match than
2527 /// derived-to-base conversion (a concrete allocator pointer converted
2528 /// to `bslma::Allocator *`).
2529 template <class TYPE_OR_ALLOCATOR>
2530 explicit
2531 Variant4(const TYPE_OR_ALLOCATOR& valueOrAllocator);
2532
2533 /// Create a variant object having the specified `value` of template
2534 /// parameter `TYPE` and that uses the specified `basicAllocator` to
2535 /// supply memory. If `basicAllocator` is 0, the currently installed
2536 /// default allocator is used. `TYPE` must be the same as one of the
2537 /// types that this variant can hold.
2538 template <class TYPE>
2539 Variant4(const TYPE& value, bslma::Allocator *basicAllocator);
2540
2541 template <class TYPE>
2542 explicit
2543#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2544 Variant4(TYPE&& value,
2545 typename bsl::enable_if<
2546 !bsl::is_same<
2547 SelfType,
2548 typename bsl::remove_const<
2549 typename bsl::remove_reference<TYPE>::type>::type>::value
2550 &&
2552 void>::type * = 0);
2553#else
2554 Variant4(bslmf::MovableRef<TYPE> value);
2555#endif
2556 // Create a variant object having the specified 'value' of template
2557 // parameter 'TYPE' by moving the contents of 'value' to the
2558 // newly-created object. Use the currently installed default allocator
2559 // to supply memory. 'value' is left in a valid but unspecified state.
2560 // 'TYPE' must be the same as one of the types that this variant can
2561 // hold. Note that in C++11 mode, this method does not participate in
2562 // overload resolution if it would lead to ambiguity with the move
2563 // constructor that does not take an allocator (below) or with the
2564 // constructor taking a 'valueOrAllocator' (above).
2565
2566 template <class TYPE>
2567#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2568 Variant4(TYPE&& value,
2569 typename bsl::enable_if<
2570 !bsl::is_same<
2571 SelfType,
2572 typename bsl::remove_const<
2573 typename bsl::remove_reference<TYPE>::type>::type>::value,
2574 bslma::Allocator>::type *basicAllocator);
2575#else
2576 Variant4(bslmf::MovableRef<TYPE> value,
2577 bslma::Allocator *basicAllocator);
2578#endif
2579 // Create a variant object having the specified 'value' of template
2580 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
2581 // memory. If 'basicAllocator' is 0, the currently installed default
2582 // allocator is used. The contents of 'value' are moved to the
2583 // newly-created object with 'value' left in a valid but unspecified
2584 // state. 'TYPE' must be the same as one of the types that this
2585 // variant can hold. Note that in C++11 mode, this method does not
2586 // participate in overload resolution if it would lead to ambiguity
2587 // with the move constructor that takes an allocator (below).
2588
2589 /// Create a variant object having the type and value of the specified
2590 /// `original` variant. Optionally specify a `basicAllocator` used to
2591 /// supply memory. If `basicAllocator` is 0, the currently installed
2592 /// default allocator is used.
2593 Variant4(const Variant4& original, bslma::Allocator *basicAllocator = 0);
2594
2595 /// Create a variant object having the type and value of the specified
2596 /// `original` object by moving the contents of `original` to the
2597 /// newly-created object. The allocator associated with `original` (if
2598 /// any) is propagated for use in the newly-created object. `original`
2599 /// is left in a valid but unspecified state.
2600 Variant4(bslmf::MovableRef<Variant4> original);
2601
2602 /// Create a variant object having the type and value of the specified
2603 /// `original` object that uses the specified `basicAllocator` to supply
2604 /// memory. If `basicAllocator` is 0, the currently installed default
2605 /// allocator is used. The contents of `original` are moved to the
2606 /// newly-created object with `original` left in a valid but unspecified
2607 /// state.
2608 Variant4(bslmf::MovableRef<Variant4> original,
2609 bslma::Allocator *basicAllocator);
2610
2611 // MANIPULATORS
2612
2613 /// Assign to this object the specified `value` of template parameter
2614 /// `TYPE`, and return a reference providing modifiable access to this
2615 /// object. The value currently held by this variant (if any) is
2616 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
2617 /// must be the same as one of the types that this variant can hold.
2618 template <class TYPE>
2619 Variant4& operator=(const TYPE& value);
2620
2621 template <class TYPE>
2622#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2623 typename bsl::enable_if<
2624 !bsl::is_same<SelfType,
2625 typename bsl::remove_cvref<TYPE>::type>::value,
2626 SelfType>::type&
2627 operator=(TYPE&& value);
2628#else
2629 Variant4&
2630 operator=(bslmf::MovableRef<TYPE> value);
2631#endif
2632 // Assign to this object the specified 'value' of template parameter
2633 // 'TYPE', and return a reference providing modifiable access to this
2634 // object. The contents of 'value' are moved to this object with
2635 // 'value' left in a valid but unspecified state. The value currently
2636 // held by this variant (if any) is destroyed if that value's type is
2637 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
2638 // that this variant can hold. Note that in C++11 mode, this method
2639 // does not participate in overload resolution if it would lead to
2640 // ambiguity with the move-assignment operator (below).
2641
2642 /// Assign to this object the type and value currently held by the
2643 /// specified `rhs` object, and return a reference providing modifiable
2644 /// access to this object. The value currently held by this variant
2645 /// (if any) is destroyed if that value's type is not the same as the
2646 /// type held by the `rhs` object.
2647 Variant4& operator=(const Variant4& rhs);
2648
2649 /// Assign to this object the type and value currently held by the
2650 /// specified `rhs` object, and return a reference providing modifiable
2651 /// access to this object. The value currently held by this variant
2652 /// (if any) is destroyed if that value's type is not the same as the
2653 /// type held by the `rhs` object. The contents of `rhs` are either
2654 /// move-inserted into or move-assigned to this object with `rhs` left
2655 /// in a valid but unspecified state.
2656 Variant4& operator=(bslmf::MovableRef<Variant4> rhs);
2657};
2658
2659 // ===================
2660 // class Variant5<...>
2661 // ===================
2662
2663/// This class is a "specialization" of `Variant` for a fixed number (5) of
2664/// types. Its 5 template arguments *must* all be specified (none are
2665/// defaulted to `bslmf::Nil`). It provides the same functionality as
2666/// `Variant<A1, A2, ..., A5>`.
2667template <class A1, class A2, class A3, class A4, class A5>
2668class Variant5 : public VariantImp<typename bslmf::TypeList5<
2669 A1, A2, A3, A4, A5>::ListType> {
2670
2671 // PRIVATE TYPES
2672 typedef VariantImp<typename bslmf::TypeList5<A1, A2, A3, A4,
2673 A5>::ListType> Imp;
2674
2675 /// `SelfType` is an alias to this class.
2676 typedef Variant5<A1, A2, A3, A4, A5> SelfType;
2677
2678 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
2679 typedef bslmf::MovableRefUtil MoveUtil;
2680
2681 public:
2682 // TRAITS
2685 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
2688 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
2691 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
2692 BSLMF_NESTED_TRAIT_DECLARATION(Variant5, HasPrintMethod);
2693
2694 // CREATORS
2695
2696 /// Create a variant object in the unset state that uses the currently
2697 /// installed default allocator to supply memory.
2698 Variant5();
2699
2700 /// Create a variant object with the specified `valueOrAllocator` that
2701 /// can be either a value of a type that the variant can hold or an
2702 /// allocator to supply memory. If `valueOrAllocator` is not a
2703 /// `bslma::Allocator *`, then the variant will hold the value and type
2704 /// of `valueOrAllocator`, and use the currently installed default
2705 /// allocator to supply memory. Otherwise, the variant will be unset
2706 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
2707 /// must be the same as one of the types that this variant can hold or
2708 /// be convertible to `bslma::Allocator *`. Note that this
2709 /// parameterized constructor is defined instead of two constructors
2710 /// (one taking a `bslma::Allocator *` and the other not) because
2711 /// template parameter arguments are always a better match than
2712 /// derived-to-base conversion (a concrete allocator pointer converted
2713 /// to `bslma::Allocator *`).
2714 template <class TYPE_OR_ALLOCATOR>
2715 explicit
2716 Variant5(const TYPE_OR_ALLOCATOR& valueOrAllocator);
2717
2718 /// Create a variant object having the specified `value` of template
2719 /// parameter `TYPE` and that uses the specified `basicAllocator` to
2720 /// supply memory. If `basicAllocator` is 0, the currently installed
2721 /// default allocator is used. `TYPE` must be the same as one of the
2722 /// types that this variant can hold.
2723 template <class TYPE>
2724 Variant5(const TYPE& value, bslma::Allocator *basicAllocator);
2725
2726 template <class TYPE>
2727 explicit
2728#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2729 Variant5(TYPE&& value,
2730 typename bsl::enable_if<
2731 !bsl::is_same<
2732 SelfType,
2733 typename bsl::remove_const<
2734 typename bsl::remove_reference<TYPE>::type>::type>::value
2735 &&
2737 void>::type * = 0);
2738#else
2739 Variant5(bslmf::MovableRef<TYPE> value);
2740#endif
2741 // Create a variant object having the specified 'value' of template
2742 // parameter 'TYPE' by moving the contents of 'value' to the
2743 // newly-created object. Use the currently installed default allocator
2744 // to supply memory. 'value' is left in a valid but unspecified state.
2745 // 'TYPE' must be the same as one of the types that this variant can
2746 // hold. Note that in C++11 mode, this method does not participate in
2747 // overload resolution if it would lead to ambiguity with the move
2748 // constructor that does not take an allocator (below) or with the
2749 // constructor taking a 'valueOrAllocator' (above).
2750
2751 template <class TYPE>
2752#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2753 Variant5(TYPE&& value,
2754 typename bsl::enable_if<
2755 !bsl::is_same<
2756 SelfType,
2757 typename bsl::remove_const<
2758 typename bsl::remove_reference<TYPE>::type>::type>::value,
2759 bslma::Allocator>::type *basicAllocator);
2760#else
2761 Variant5(bslmf::MovableRef<TYPE> value,
2762 bslma::Allocator *basicAllocator);
2763#endif
2764 // Create a variant object having the specified 'value' of template
2765 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
2766 // memory. If 'basicAllocator' is 0, the currently installed default
2767 // allocator is used. The contents of 'value' are moved to the
2768 // newly-created object with 'value' left in a valid but unspecified
2769 // state. 'TYPE' must be the same as one of the types that this
2770 // variant can hold. Note that in C++11 mode, this method does not
2771 // participate in overload resolution if it would lead to ambiguity
2772 // with the move constructor that takes an allocator (below).
2773
2774 /// Create a variant object having the type and value of the specified
2775 /// `original` variant. Optionally specify a `basicAllocator` used to
2776 /// supply memory. If `basicAllocator` is 0, the currently installed
2777 /// default allocator is used.
2778 Variant5(const Variant5& original, bslma::Allocator *basicAllocator = 0);
2779
2780 /// Create a variant object having the type and value of the specified
2781 /// `original` object by moving the contents of `original` to the
2782 /// newly-created object. The allocator associated with `original` (if
2783 /// any) is propagated for use in the newly-created object. `original`
2784 /// is left in a valid but unspecified state.
2785 Variant5(bslmf::MovableRef<Variant5> original);
2786
2787 /// Create a variant object having the type and value of the specified
2788 /// `original` object that uses the specified `basicAllocator` to supply
2789 /// memory. If `basicAllocator` is 0, the currently installed default
2790 /// allocator is used. The contents of `original` are moved to the
2791 /// newly-created object with `original` left in a valid but unspecified
2792 /// state.
2793 Variant5(bslmf::MovableRef<Variant5> original,
2794 bslma::Allocator *basicAllocator);
2795
2796 // MANIPULATORS
2797
2798 /// Assign to this object the specified `value` of template parameter
2799 /// `TYPE`, and return a reference providing modifiable access to this
2800 /// object. The value currently held by this variant (if any) is
2801 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
2802 /// must be the same as one of the types that this variant can hold.
2803 template <class TYPE>
2804 Variant5& operator=(const TYPE& value);
2805
2806 template <class TYPE>
2807#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2808 typename bsl::enable_if<
2809 !bsl::is_same<SelfType,
2810 typename bsl::remove_cvref<TYPE>::type>::value,
2811 SelfType>::type&
2812 operator=(TYPE&& value);
2813#else
2814 Variant5&
2815 operator=(bslmf::MovableRef<TYPE> value);
2816#endif
2817 // Assign to this object the specified 'value' of template parameter
2818 // 'TYPE', and return a reference providing modifiable access to this
2819 // object. The contents of 'value' are moved to this object with
2820 // 'value' left in a valid but unspecified state. The value currently
2821 // held by this variant (if any) is destroyed if that value's type is
2822 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
2823 // that this variant can hold. Note that in C++11 mode, this method
2824 // does not participate in overload resolution if it would lead to
2825 // ambiguity with the move-assignment operator (below).
2826
2827 /// Assign to this object the type and value currently held by the
2828 /// specified `rhs` object, and return a reference providing modifiable
2829 /// access to this object. The value currently held by this variant
2830 /// (if any) is destroyed if that value's type is not the same as the
2831 /// type held by the `rhs` object.
2832 Variant5& operator=(const Variant5& rhs);
2833
2834 /// Assign to this object the type and value currently held by the
2835 /// specified `rhs` object, and return a reference providing modifiable
2836 /// access to this object. The value currently held by this variant
2837 /// (if any) is destroyed if that value's type is not the same as the
2838 /// type held by the `rhs` object. The contents of `rhs` are either
2839 /// move-inserted into or move-assigned to this object with `rhs` left
2840 /// in a valid but unspecified state.
2841 Variant5& operator=(bslmf::MovableRef<Variant5> rhs);
2842};
2843
2844 // ===================
2845 // class Variant6<...>
2846 // ===================
2847
2848/// This class is a "specialization" of `Variant` for a fixed number (6) of
2849/// types. Its 6 template arguments *must* all be specified (none are
2850/// defaulted to `bslmf::Nil`). It provides the same functionality as
2851/// `Variant<A1, A2, ..., A6>`.
2852template <class A1, class A2, class A3, class A4, class A5, class A6>
2853class Variant6 : public VariantImp<typename bslmf::TypeList6<
2854 A1, A2, A3, A4, A5, A6>::ListType> {
2855
2856 // PRIVATE TYPES
2857 typedef VariantImp<typename bslmf::TypeList6<A1, A2, A3, A4, A5,
2858 A6>::ListType> Imp;
2859
2860 /// `SelfType` is an alias to this class.
2861 typedef Variant6<A1, A2, A3, A4, A5, A6> SelfType;
2862
2863 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
2864 typedef bslmf::MovableRefUtil MoveUtil;
2865
2866 public:
2867 // TRAITS
2870 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
2873 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
2876 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
2877 BSLMF_NESTED_TRAIT_DECLARATION(Variant6, HasPrintMethod);
2878
2879 // CREATORS
2880
2881 /// Create a variant object in the unset state that uses the currently
2882 /// installed default allocator to supply memory.
2883 Variant6();
2884
2885 /// Create a variant object with the specified `valueOrAllocator` that
2886 /// can be either a value of a type that the variant can hold or an
2887 /// allocator to supply memory. If `valueOrAllocator` is not a
2888 /// `bslma::Allocator *`, then the variant will hold the value and type
2889 /// of `valueOrAllocator`, and use the currently installed default
2890 /// allocator to supply memory. Otherwise, the variant will be unset
2891 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
2892 /// must be the same as one of the types that this variant can hold or
2893 /// be convertible to `bslma::Allocator *`. Note that this
2894 /// parameterized constructor is defined instead of two constructors
2895 /// (one taking a `bslma::Allocator *` and the other not) because
2896 /// template parameter arguments are always a better match than
2897 /// derived-to-base conversion (a concrete allocator pointer converted
2898 /// to `bslma::Allocator *`).
2899 template <class TYPE_OR_ALLOCATOR>
2900 explicit
2901 Variant6(const TYPE_OR_ALLOCATOR& valueOrAllocator);
2902
2903 /// Create a variant object having the specified `value` of template
2904 /// parameter `TYPE` and that uses the specified `basicAllocator` to
2905 /// supply memory. If `basicAllocator` is 0, the currently installed
2906 /// default allocator is used. `TYPE` must be the same as one of the
2907 /// types that this variant can hold.
2908 template <class TYPE>
2909 Variant6(const TYPE& value, bslma::Allocator *basicAllocator);
2910
2911 template <class TYPE>
2912 explicit
2913#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2914 Variant6(TYPE&& value,
2915 typename bsl::enable_if<
2916 !bsl::is_same<
2917 SelfType,
2918 typename bsl::remove_const<
2919 typename bsl::remove_reference<TYPE>::type>::type>::value
2920 &&
2922 void>::type * = 0);
2923#else
2924 Variant6(bslmf::MovableRef<TYPE> value);
2925#endif
2926 // Create a variant object having the specified 'value' of template
2927 // parameter 'TYPE' by moving the contents of 'value' to the
2928 // newly-created object. Use the currently installed default allocator
2929 // to supply memory. 'value' is left in a valid but unspecified state.
2930 // 'TYPE' must be the same as one of the types that this variant can
2931 // hold. Note that in C++11 mode, this method does not participate in
2932 // overload resolution if it would lead to ambiguity with the move
2933 // constructor that does not take an allocator (below) or with the
2934 // constructor taking a 'valueOrAllocator' (above).
2935
2936 template <class TYPE>
2937#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2938 Variant6(TYPE&& value,
2939 typename bsl::enable_if<
2940 !bsl::is_same<
2941 SelfType,
2942 typename bsl::remove_const<
2943 typename bsl::remove_reference<TYPE>::type>::type>::value,
2944 bslma::Allocator>::type *basicAllocator);
2945#else
2946 Variant6(bslmf::MovableRef<TYPE> value,
2947 bslma::Allocator *basicAllocator);
2948#endif
2949 // Create a variant object having the specified 'value' of template
2950 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
2951 // memory. If 'basicAllocator' is 0, the currently installed default
2952 // allocator is used. The contents of 'value' are moved to the
2953 // newly-created object with 'value' left in a valid but unspecified
2954 // state. 'TYPE' must be the same as one of the types that this
2955 // variant can hold. Note that in C++11 mode, this method does not
2956 // participate in overload resolution if it would lead to ambiguity
2957 // with the move constructor that takes an allocator (below).
2958
2959 /// Create a variant object having the type and value of the specified
2960 /// `original` variant. Optionally specify a `basicAllocator` used to
2961 /// supply memory. If `basicAllocator` is 0, the currently installed
2962 /// default allocator is used.
2963 Variant6(const Variant6& original, bslma::Allocator *basicAllocator = 0);
2964
2965 /// Create a variant object having the type and value of the specified
2966 /// `original` object by moving the contents of `original` to the
2967 /// newly-created object. The allocator associated with `original` (if
2968 /// any) is propagated for use in the newly-created object. `original`
2969 /// is left in a valid but unspecified state.
2970 Variant6(bslmf::MovableRef<Variant6> original);
2971
2972 /// Create a variant object having the type and value of the specified
2973 /// `original` object that uses the specified `basicAllocator` to supply
2974 /// memory. If `basicAllocator` is 0, the currently installed default
2975 /// allocator is used. The contents of `original` are moved to the
2976 /// newly-created object with `original` left in a valid but unspecified
2977 /// state.
2978 Variant6(bslmf::MovableRef<Variant6> original,
2979 bslma::Allocator *basicAllocator);
2980
2981 // MANIPULATORS
2982
2983 /// Assign to this object the specified `value` of template parameter
2984 /// `TYPE`, and return a reference providing modifiable access to this
2985 /// object. The value currently held by this variant (if any) is
2986 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
2987 /// must be the same as one of the types that this variant can hold.
2988 template <class TYPE>
2989 Variant6& operator=(const TYPE& value);
2990
2991 template <class TYPE>
2992#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2993 typename bsl::enable_if<
2994 !bsl::is_same<SelfType,
2995 typename bsl::remove_cvref<TYPE>::type>::value,
2996 SelfType>::type&
2997 operator=(TYPE&& value);
2998#else
2999 Variant6&
3000 operator=(bslmf::MovableRef<TYPE> value);
3001#endif
3002 // Assign to this object the specified 'value' of template parameter
3003 // 'TYPE', and return a reference providing modifiable access to this
3004 // object. The contents of 'value' are moved to this object with
3005 // 'value' left in a valid but unspecified state. The value currently
3006 // held by this variant (if any) is destroyed if that value's type is
3007 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
3008 // that this variant can hold. Note that in C++11 mode, this method
3009 // does not participate in overload resolution if it would lead to
3010 // ambiguity with the move-assignment operator (below).
3011
3012 /// Assign to this object the type and value currently held by the
3013 /// specified `rhs` object, and return a reference providing modifiable
3014 /// access to this object. The value currently held by this variant
3015 /// (if any) is destroyed if that value's type is not the same as the
3016 /// type held by the `rhs` object.
3017 Variant6& operator=(const Variant6& rhs);
3018
3019 /// Assign to this object the type and value currently held by the
3020 /// specified `rhs` object, and return a reference providing modifiable
3021 /// access to this object. The value currently held by this variant
3022 /// (if any) is destroyed if that value's type is not the same as the
3023 /// type held by the `rhs` object. The contents of `rhs` are either
3024 /// move-inserted into or move-assigned to this object with `rhs` left
3025 /// in a valid but unspecified state.
3026 Variant6& operator=(bslmf::MovableRef<Variant6> rhs);
3027};
3028
3029 // ===================
3030 // class Variant7<...>
3031 // ===================
3032
3033/// This class is a "specialization" of `Variant` for a fixed number (7) of
3034/// types. Its 7 template arguments *must* all be specified (none are
3035/// defaulted to `bslmf::Nil`). It provides the same functionality as
3036/// `Variant<A1, A2, ..., A7>`.
3037template <class A1, class A2, class A3, class A4, class A5, class A6,
3038 class A7>
3039class Variant7 : public VariantImp<typename bslmf::TypeList7<
3040 A1, A2, A3, A4, A5, A6, A7>::ListType> {
3041
3042 // PRIVATE TYPES
3043 typedef VariantImp<typename bslmf::TypeList7<A1, A2, A3, A4, A5, A6,
3044 A7>::ListType> Imp;
3045
3046 /// `SelfType` is an alias to this class.
3047 typedef Variant7<A1, A2, A3, A4, A5, A6, A7> SelfType;
3048
3049 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
3050 typedef bslmf::MovableRefUtil MoveUtil;
3051
3052 public:
3053 // TRAITS
3056 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
3059 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
3062 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
3063 BSLMF_NESTED_TRAIT_DECLARATION(Variant7, HasPrintMethod);
3064
3065 // CREATORS
3066
3067 /// Create a variant object in the unset state that uses the currently
3068 /// installed default allocator to supply memory.
3069 Variant7();
3070
3071 /// Create a variant object with the specified `valueOrAllocator` that
3072 /// can be either a value of a type that the variant can hold or an
3073 /// allocator to supply memory. If `valueOrAllocator` is not a
3074 /// `bslma::Allocator *`, then the variant will hold the value and type
3075 /// of `valueOrAllocator`, and use the currently installed default
3076 /// allocator to supply memory. Otherwise, the variant will be unset
3077 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
3078 /// must be the same as one of the types that this variant can hold or
3079 /// be convertible to `bslma::Allocator *`. Note that this
3080 /// parameterized constructor is defined instead of two constructors
3081 /// (one taking a `bslma::Allocator *` and the other not) because
3082 /// template parameter arguments are always a better match than
3083 /// derived-to-base conversion (a concrete allocator pointer converted
3084 /// to `bslma::Allocator *`).
3085 template <class TYPE_OR_ALLOCATOR>
3086 explicit
3087 Variant7(const TYPE_OR_ALLOCATOR& valueOrAllocator);
3088
3089 /// Create a variant object having the specified `value` of template
3090 /// parameter `TYPE` and that uses the specified `basicAllocator` to
3091 /// supply memory. If `basicAllocator` is 0, the currently installed
3092 /// default allocator is used. `TYPE` must be the same as one of the
3093 /// types that this variant can hold.
3094 template <class TYPE>
3095 Variant7(const TYPE& value, bslma::Allocator *basicAllocator);
3096
3097 template <class TYPE>
3098 explicit
3099#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3100 Variant7(TYPE&& value,
3101 typename bsl::enable_if<
3102 !bsl::is_same<
3103 SelfType,
3104 typename bsl::remove_const<
3105 typename bsl::remove_reference<TYPE>::type>::type>::value
3106 &&
3108 void>::type * = 0);
3109#else
3110 Variant7(bslmf::MovableRef<TYPE> value);
3111#endif
3112 // Create a variant object having the specified 'value' of template
3113 // parameter 'TYPE' by moving the contents of 'value' to the
3114 // newly-created object. Use the currently installed default allocator
3115 // to supply memory. 'value' is left in a valid but unspecified state.
3116 // 'TYPE' must be the same as one of the types that this variant can
3117 // hold. Note that in C++11 mode, this method does not participate in
3118 // overload resolution if it would lead to ambiguity with the move
3119 // constructor that does not take an allocator (below) or with the
3120 // constructor taking a 'valueOrAllocator' (above).
3121
3122 template <class TYPE>
3123#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3124 Variant7(TYPE&& value,
3125 typename bsl::enable_if<
3126 !bsl::is_same<
3127 SelfType,
3128 typename bsl::remove_const<
3129 typename bsl::remove_reference<TYPE>::type>::type>::value,
3130 bslma::Allocator>::type *basicAllocator);
3131#else
3132 Variant7(bslmf::MovableRef<TYPE> value,
3133 bslma::Allocator *basicAllocator);
3134#endif
3135 // Create a variant object having the specified 'value' of template
3136 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
3137 // memory. If 'basicAllocator' is 0, the currently installed default
3138 // allocator is used. The contents of 'value' are moved to the
3139 // newly-created object with 'value' left in a valid but unspecified
3140 // state. 'TYPE' must be the same as one of the types that this
3141 // variant can hold. Note that in C++11 mode, this method does not
3142 // participate in overload resolution if it would lead to ambiguity
3143 // with the move constructor that takes an allocator (below).
3144
3145 /// Create a variant object having the type and value of the specified
3146 /// `original` variant. Optionally specify a `basicAllocator` used to
3147 /// supply memory. If `basicAllocator` is 0, the currently installed
3148 /// default allocator is used.
3149 Variant7(const Variant7& original, bslma::Allocator *basicAllocator = 0);
3150
3151 /// Create a variant object having the type and value of the specified
3152 /// `original` object by moving the contents of `original` to the
3153 /// newly-created object. The allocator associated with `original` (if
3154 /// any) is propagated for use in the newly-created object. `original`
3155 /// is left in a valid but unspecified state.
3156 Variant7(bslmf::MovableRef<Variant7> original);
3157
3158 /// Create a variant object having the type and value of the specified
3159 /// `original` object that uses the specified `basicAllocator` to supply
3160 /// memory. If `basicAllocator` is 0, the currently installed default
3161 /// allocator is used. The contents of `original` are moved to the
3162 /// newly-created object with `original` left in a valid but unspecified
3163 /// state.
3164 Variant7(bslmf::MovableRef<Variant7> original,
3165 bslma::Allocator *basicAllocator);
3166
3167 // MANIPULATORS
3168
3169 /// Assign to this object the specified `value` of template parameter
3170 /// `TYPE`, and return a reference providing modifiable access to this
3171 /// object. The value currently held by this variant (if any) is
3172 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
3173 /// must be the same as one of the types that this variant can hold.
3174 template <class TYPE>
3175 Variant7& operator=(const TYPE& value);
3176
3177 template <class TYPE>
3178#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3179 typename bsl::enable_if<
3180 !bsl::is_same<SelfType,
3181 typename bsl::remove_cvref<TYPE>::type>::value,
3182 SelfType>::type&
3183 operator=(TYPE&& value);
3184#else
3185 Variant7&
3186 operator=(bslmf::MovableRef<TYPE> value);
3187#endif
3188 // Assign to this object the specified 'value' of template parameter
3189 // 'TYPE', and return a reference providing modifiable access to this
3190 // object. The contents of 'value' are moved to this object with
3191 // 'value' left in a valid but unspecified state. The value currently
3192 // held by this variant (if any) is destroyed if that value's type is
3193 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
3194 // that this variant can hold. Note that in C++11 mode, this method
3195 // does not participate in overload resolution if it would lead to
3196 // ambiguity with the move-assignment operator (below).
3197
3198 /// Assign to this object the type and value currently held by the
3199 /// specified `rhs` object, and return a reference providing modifiable
3200 /// access to this object. The value currently held by this variant
3201 /// (if any) is destroyed if that value's type is not the same as the
3202 /// type held by the `rhs` object.
3203 Variant7& operator=(const Variant7& rhs);
3204
3205 /// Assign to this object the type and value currently held by the
3206 /// specified `rhs` object, and return a reference providing modifiable
3207 /// access to this object. The value currently held by this variant
3208 /// (if any) is destroyed if that value's type is not the same as the
3209 /// type held by the `rhs` object. The contents of `rhs` are either
3210 /// move-inserted into or move-assigned to this object with `rhs` left
3211 /// in a valid but unspecified state.
3212 Variant7& operator=(bslmf::MovableRef<Variant7> rhs);
3213};
3214
3215 // ===================
3216 // class Variant8<...>
3217 // ===================
3218
3219/// This class is a "specialization" of `Variant` for a fixed number (8) of
3220/// types. Its 8 template arguments *must* all be specified (none are
3221/// defaulted to `bslmf::Nil`). It provides the same functionality as
3222/// `Variant<A1, A2, ..., A8>`.
3223template <class A1, class A2, class A3, class A4, class A5, class A6,
3224 class A7, class A8>
3225class Variant8 : public VariantImp<typename bslmf::TypeList8<
3226 A1, A2, A3, A4, A5, A6, A7, A8>::ListType> {
3227
3228 // PRIVATE TYPES
3229 typedef VariantImp<typename bslmf::TypeList8<A1, A2, A3, A4, A5, A6, A7,
3230 A8>::ListType> Imp;
3231
3232 /// `SelfType` is an alias to this class.
3233 typedef Variant8<A1, A2, A3, A4, A5, A6, A7, A8> SelfType;
3234
3235 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
3236 typedef bslmf::MovableRefUtil MoveUtil;
3237
3238 public:
3239 // TRAITS
3242 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
3245 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
3248 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
3249 BSLMF_NESTED_TRAIT_DECLARATION(Variant8, HasPrintMethod);
3250
3251 // CREATORS
3252
3253 /// Create a variant object in the unset state that uses the currently
3254 /// installed default allocator to supply memory.
3255 Variant8();
3256
3257 /// Create a variant object with the specified `valueOrAllocator` that
3258 /// can be either a value of a type that the variant can hold or an
3259 /// allocator to supply memory. If `valueOrAllocator` is not a
3260 /// `bslma::Allocator *`, then the variant will hold the value and type
3261 /// of `valueOrAllocator`, and use the currently installed default
3262 /// allocator to supply memory. Otherwise, the variant will be unset
3263 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
3264 /// must be the same as one of the types that this variant can hold or
3265 /// be convertible to `bslma::Allocator *`. Note that this
3266 /// parameterized constructor is defined instead of two constructors
3267 /// (one taking a `bslma::Allocator *` and the other not) because
3268 /// template parameter arguments are always a better match than
3269 /// derived-to-base conversion (a concrete allocator pointer converted
3270 /// to `bslma::Allocator *`).
3271 template <class TYPE_OR_ALLOCATOR>
3272 explicit
3273 Variant8(const TYPE_OR_ALLOCATOR& valueOrAllocator);
3274
3275 /// Create a variant object having the specified `value` of template
3276 /// parameter `TYPE` and that uses the specified `basicAllocator` to
3277 /// supply memory. If `basicAllocator` is 0, the currently installed
3278 /// default allocator is used. `TYPE` must be the same as one of the
3279 /// types that this variant can hold.
3280 template <class TYPE>
3281 Variant8(const TYPE& value, bslma::Allocator *basicAllocator);
3282
3283 template <class TYPE>
3284 explicit
3285#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3286 Variant8(TYPE&& value,
3287 typename bsl::enable_if<
3288 !bsl::is_same<
3289 SelfType,
3290 typename bsl::remove_const<
3291 typename bsl::remove_reference<TYPE>::type>::type>::value
3292 &&
3294 void>::type * = 0);
3295#else
3296 Variant8(bslmf::MovableRef<TYPE> value);
3297#endif
3298 // Create a variant object having the specified 'value' of template
3299 // parameter 'TYPE' by moving the contents of 'value' to the
3300 // newly-created object. Use the currently installed default allocator
3301 // to supply memory. 'value' is left in a valid but unspecified state.
3302 // 'TYPE' must be the same as one of the types that this variant can
3303 // hold. Note that in C++11 mode, this method does not participate in
3304 // overload resolution if it would lead to ambiguity with the move
3305 // constructor that does not take an allocator (below) or with the
3306 // constructor taking a 'valueOrAllocator' (above).
3307
3308 template <class TYPE>
3309#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3310 Variant8(TYPE&& value,
3311 typename bsl::enable_if<
3312 !bsl::is_same<
3313 SelfType,
3314 typename bsl::remove_const<
3315 typename bsl::remove_reference<TYPE>::type>::type>::value,
3316 bslma::Allocator>::type *basicAllocator);
3317#else
3318 Variant8(bslmf::MovableRef<TYPE> value,
3319 bslma::Allocator *basicAllocator);
3320#endif
3321 // Create a variant object having the specified 'value' of template
3322 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
3323 // memory. If 'basicAllocator' is 0, the currently installed default
3324 // allocator is used. The contents of 'value' are moved to the
3325 // newly-created object with 'value' left in a valid but unspecified
3326 // state. 'TYPE' must be the same as one of the types that this
3327 // variant can hold. Note that in C++11 mode, this method does not
3328 // participate in overload resolution if it would lead to ambiguity
3329 // with the move constructor that takes an allocator (below).
3330
3331 /// Create a variant object having the type and value of the specified
3332 /// `original` variant. Optionally specify a `basicAllocator` used to
3333 /// supply memory. If `basicAllocator` is 0, the currently installed
3334 /// default allocator is used.
3335 Variant8(const Variant8& original, bslma::Allocator *basicAllocator = 0);
3336
3337 /// Create a variant object having the type and value of the specified
3338 /// `original` object by moving the contents of `original` to the
3339 /// newly-created object. The allocator associated with `original` (if
3340 /// any) is propagated for use in the newly-created object. `original`
3341 /// is left in a valid but unspecified state.
3342 Variant8(bslmf::MovableRef<Variant8> original);
3343
3344 /// Create a variant object having the type and value of the specified
3345 /// `original` object that uses the specified `basicAllocator` to supply
3346 /// memory. If `basicAllocator` is 0, the currently installed default
3347 /// allocator is used. The contents of `original` are moved to the
3348 /// newly-created object with `original` left in a valid but unspecified
3349 /// state.
3350 Variant8(bslmf::MovableRef<Variant8> original,
3351 bslma::Allocator *basicAllocator);
3352
3353 // MANIPULATORS
3354
3355 /// Assign to this object the specified `value` of template parameter
3356 /// `TYPE`, and return a reference providing modifiable access to this
3357 /// object. The value currently held by this variant (if any) is
3358 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
3359 /// must be the same as one of the types that this variant can hold.
3360 template <class TYPE>
3361 Variant8& operator=(const TYPE& value);
3362
3363 template <class TYPE>
3364#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3365 typename bsl::enable_if<
3366 !bsl::is_same<SelfType,
3367 typename bsl::remove_cvref<TYPE>::type>::value,
3368 SelfType>::type&
3369 operator=(TYPE&& value);
3370#else
3371 Variant8&
3372 operator=(bslmf::MovableRef<TYPE> value);
3373#endif
3374 // Assign to this object the specified 'value' of template parameter
3375 // 'TYPE', and return a reference providing modifiable access to this
3376 // object. The contents of 'value' are moved to this object with
3377 // 'value' left in a valid but unspecified state. The value currently
3378 // held by this variant (if any) is destroyed if that value's type is
3379 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
3380 // that this variant can hold. Note that in C++11 mode, this method
3381 // does not participate in overload resolution if it would lead to
3382 // ambiguity with the move-assignment operator (below).
3383
3384 /// Assign to this object the type and value currently held by the
3385 /// specified `rhs` object, and return a reference providing modifiable
3386 /// access to this object. The value currently held by this variant
3387 /// (if any) is destroyed if that value's type is not the same as the
3388 /// type held by the `rhs` object.
3389 Variant8& operator=(const Variant8& rhs);
3390
3391 /// Assign to this object the type and value currently held by the
3392 /// specified `rhs` object, and return a reference providing modifiable
3393 /// access to this object. The value currently held by this variant
3394 /// (if any) is destroyed if that value's type is not the same as the
3395 /// type held by the `rhs` object. The contents of `rhs` are either
3396 /// move-inserted into or move-assigned to this object with `rhs` left
3397 /// in a valid but unspecified state.
3398 Variant8& operator=(bslmf::MovableRef<Variant8> rhs);
3399};
3400
3401 // ===================
3402 // class Variant9<...>
3403 // ===================
3404
3405/// This class is a "specialization" of `Variant` for a fixed number (9) of
3406/// types. Its 9 template arguments *must* all be specified (none are
3407/// defaulted to `bslmf::Nil`). It provides the same functionality as
3408/// `Variant<A1, A2, ..., A9>`.
3409template <class A1, class A2, class A3, class A4, class A5, class A6,
3410 class A7, class A8, class A9>
3411class Variant9 : public VariantImp<typename bslmf::TypeList9<
3412 A1, A2, A3, A4, A5, A6, A7, A8, A9>::ListType> {
3413
3414 // PRIVATE TYPES
3415 typedef VariantImp<typename bslmf::TypeList9<A1, A2, A3, A4, A5, A6, A7,
3416 A8, A9>::ListType> Imp;
3417
3418 /// `SelfType` is an alias to this class.
3419 typedef Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9> SelfType;
3420
3421 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
3422 typedef bslmf::MovableRefUtil MoveUtil;
3423
3424 public:
3425 // TRAITS
3428 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
3431 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
3434 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
3435 BSLMF_NESTED_TRAIT_DECLARATION(Variant9, HasPrintMethod);
3436
3437 // CREATORS
3438
3439 /// Create a variant object in the unset state that uses the currently
3440 /// installed default allocator to supply memory.
3441 Variant9();
3442
3443 /// Create a variant object with the specified `valueOrAllocator` that
3444 /// can be either a value of a type that the variant can hold or an
3445 /// allocator to supply memory. If `valueOrAllocator` is not a
3446 /// `bslma::Allocator *`, then the variant will hold the value and type
3447 /// of `valueOrAllocator`, and use the currently installed default
3448 /// allocator to supply memory. Otherwise, the variant will be unset
3449 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
3450 /// must be the same as one of the types that this variant can hold or
3451 /// be convertible to `bslma::Allocator *`. Note that this
3452 /// parameterized constructor is defined instead of two constructors
3453 /// (one taking a `bslma::Allocator *` and the other not) because
3454 /// template parameter arguments are always a better match than
3455 /// derived-to-base conversion (a concrete allocator pointer converted
3456 /// to `bslma::Allocator *`).
3457 template <class TYPE_OR_ALLOCATOR>
3458 explicit
3459 Variant9(const TYPE_OR_ALLOCATOR& valueOrAllocator);
3460
3461 /// Create a variant object having the specified `value` of template
3462 /// parameter `TYPE` and that uses the specified `basicAllocator` to
3463 /// supply memory. If `basicAllocator` is 0, the currently installed
3464 /// default allocator is used. `TYPE` must be the same as one of the
3465 /// types that this variant can hold.
3466 template <class TYPE>
3467 Variant9(const TYPE& value, bslma::Allocator *basicAllocator);
3468
3469 template <class TYPE>
3470 explicit
3471#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3472 Variant9(TYPE&& value,
3473 typename bsl::enable_if<
3474 !bsl::is_same<
3475 SelfType,
3476 typename bsl::remove_const<
3477 typename bsl::remove_reference<TYPE>::type>::type>::value
3478 &&
3480 void>::type * = 0);
3481#else
3482 Variant9(bslmf::MovableRef<TYPE> value);
3483#endif
3484 // Create a variant object having the specified 'value' of template
3485 // parameter 'TYPE' by moving the contents of 'value' to the
3486 // newly-created object. Use the currently installed default allocator
3487 // to supply memory. 'value' is left in a valid but unspecified state.
3488 // 'TYPE' must be the same as one of the types that this variant can
3489 // hold. Note that in C++11 mode, this method does not participate in
3490 // overload resolution if it would lead to ambiguity with the move
3491 // constructor that does not take an allocator (below) or with the
3492 // constructor taking a 'valueOrAllocator' (above).
3493
3494 template <class TYPE>
3495#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3496 Variant9(TYPE&& value,
3497 typename bsl::enable_if<
3498 !bsl::is_same<
3499 SelfType,
3500 typename bsl::remove_const<
3501 typename bsl::remove_reference<TYPE>::type>::type>::value,
3502 bslma::Allocator>::type *basicAllocator);
3503#else
3504 Variant9(bslmf::MovableRef<TYPE> value,
3505 bslma::Allocator *basicAllocator);
3506#endif
3507 // Create a variant object having the specified 'value' of template
3508 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
3509 // memory. If 'basicAllocator' is 0, the currently installed default
3510 // allocator is used. The contents of 'value' are moved to the
3511 // newly-created object with 'value' left in a valid but unspecified
3512 // state. 'TYPE' must be the same as one of the types that this
3513 // variant can hold. Note that in C++11 mode, this method does not
3514 // participate in overload resolution if it would lead to ambiguity
3515 // with the move constructor that takes an allocator (below).
3516
3517 /// Create a variant object having the type and value of the specified
3518 /// `original` variant. Optionally specify a `basicAllocator` used to
3519 /// supply memory. If `basicAllocator` is 0, the currently installed
3520 /// default allocator is used.
3521 Variant9(const Variant9& original, bslma::Allocator *basicAllocator = 0);
3522
3523 /// Create a variant object having the type and value of the specified
3524 /// `original` object by moving the contents of `original` to the
3525 /// newly-created object. The allocator associated with `original` (if
3526 /// any) is propagated for use in the newly-created object. `original`
3527 /// is left in a valid but unspecified state.
3528 Variant9(bslmf::MovableRef<Variant9> original);
3529
3530 /// Create a variant object having the type and value of the specified
3531 /// `original` object that uses the specified `basicAllocator` to supply
3532 /// memory. If `basicAllocator` is 0, the currently installed default
3533 /// allocator is used. The contents of `original` are moved to the
3534 /// newly-created object with `original` left in a valid but unspecified
3535 /// state.
3536 Variant9(bslmf::MovableRef<Variant9> original,
3537 bslma::Allocator *basicAllocator);
3538
3539 // MANIPULATORS
3540
3541 /// Assign to this object the specified `value` of template parameter
3542 /// `TYPE`, and return a reference providing modifiable access to this
3543 /// object. The value currently held by this variant (if any) is
3544 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
3545 /// must be the same as one of the types that this variant can hold.
3546 template <class TYPE>
3547 Variant9& operator=(const TYPE& value);
3548
3549 template <class TYPE>
3550#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3551 typename bsl::enable_if<
3552 !bsl::is_same<SelfType,
3553 typename bsl::remove_cvref<TYPE>::type>::value,
3554 SelfType>::type&
3555 operator=(TYPE&& value);
3556#else
3557 Variant9&
3558 operator=(bslmf::MovableRef<TYPE> value);
3559#endif
3560 // Assign to this object the specified 'value' of template parameter
3561 // 'TYPE', and return a reference providing modifiable access to this
3562 // object. The contents of 'value' are moved to this object with
3563 // 'value' left in a valid but unspecified state. The value currently
3564 // held by this variant (if any) is destroyed if that value's type is
3565 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
3566 // that this variant can hold. Note that in C++11 mode, this method
3567 // does not participate in overload resolution if it would lead to
3568 // ambiguity with the move-assignment operator (below).
3569
3570 /// Assign to this object the type and value currently held by the
3571 /// specified `rhs` object, and return a reference providing modifiable
3572 /// access to this object. The value currently held by this variant
3573 /// (if any) is destroyed if that value's type is not the same as the
3574 /// type held by the `rhs` object.
3575 Variant9& operator=(const Variant9& rhs);
3576
3577 /// Assign to this object the type and value currently held by the
3578 /// specified `rhs` object, and return a reference providing modifiable
3579 /// access to this object. The value currently held by this variant
3580 /// (if any) is destroyed if that value's type is not the same as the
3581 /// type held by the `rhs` object. The contents of `rhs` are either
3582 /// move-inserted into or move-assigned to this object with `rhs` left
3583 /// in a valid but unspecified state.
3584 Variant9& operator=(bslmf::MovableRef<Variant9> rhs);
3585};
3586
3587 // ====================
3588 // class Variant10<...>
3589 // ====================
3590
3591/// This class is a "specialization" of `Variant` for a fixed number (10) of
3592/// types. Its 10 template arguments *must* all be specified (none are
3593/// defaulted to `bslmf::Nil`). It provides the same functionality as
3594/// `Variant<A1, A2, ..., A10>`.
3595template <class A1, class A2, class A3, class A4, class A5, class A6,
3596 class A7, class A8, class A9, class A10>
3597class Variant10 : public VariantImp<typename bslmf::TypeList10<
3598 A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::ListType> {
3599
3600 // PRIVATE TYPES
3601 typedef VariantImp<typename bslmf::TypeList10<A1, A2, A3, A4, A5, A6, A7,
3602 A8, A9,
3603 A10>::ListType> Imp;
3604
3605 /// `SelfType` is an alias to this class.
3606 typedef Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> SelfType;
3607
3608 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
3609 typedef bslmf::MovableRefUtil MoveUtil;
3610
3611 public:
3612 // TRAITS
3615 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
3618 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
3621 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
3622 BSLMF_NESTED_TRAIT_DECLARATION(Variant10, HasPrintMethod);
3623
3624 // CREATORS
3625
3626 /// Create a variant object in the unset state that uses the currently
3627 /// installed default allocator to supply memory.
3628 Variant10();
3629
3630 /// Create a variant object with the specified `valueOrAllocator` that
3631 /// can be either a value of a type that the variant can hold or an
3632 /// allocator to supply memory. If `valueOrAllocator` is not a
3633 /// `bslma::Allocator *`, then the variant will hold the value and type
3634 /// of `valueOrAllocator`, and use the currently installed default
3635 /// allocator to supply memory. Otherwise, the variant will be unset
3636 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
3637 /// must be the same as one of the types that this variant can hold or
3638 /// be convertible to `bslma::Allocator *`. Note that this
3639 /// parameterized constructor is defined instead of two constructors
3640 /// (one taking a `bslma::Allocator *` and the other not) because
3641 /// template parameter arguments are always a better match than
3642 /// derived-to-base conversion (a concrete allocator pointer converted
3643 /// to `bslma::Allocator *`).
3644 template <class TYPE_OR_ALLOCATOR>
3645 explicit
3646 Variant10(const TYPE_OR_ALLOCATOR& valueOrAllocator);
3647
3648 /// Create a variant object having the specified `value` of template
3649 /// parameter `TYPE` and that uses the specified `basicAllocator` to
3650 /// supply memory. If `basicAllocator` is 0, the currently installed
3651 /// default allocator is used. `TYPE` must be the same as one of the
3652 /// types that this variant can hold.
3653 template <class TYPE>
3654 Variant10(const TYPE& value, bslma::Allocator *basicAllocator);
3655
3656 template <class TYPE>
3657 explicit
3658#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3659 Variant10(TYPE&& value,
3660 typename bsl::enable_if<
3661 !bsl::is_same<
3662 SelfType,
3663 typename bsl::remove_const<
3664 typename bsl::remove_reference<TYPE>::type>::type>::value
3665 &&
3667 void>::type * = 0);
3668#else
3669 Variant10(bslmf::MovableRef<TYPE> value);
3670#endif
3671 // Create a variant object having the specified 'value' of template
3672 // parameter 'TYPE' by moving the contents of 'value' to the
3673 // newly-created object. Use the currently installed default allocator
3674 // to supply memory. 'value' is left in a valid but unspecified state.
3675 // 'TYPE' must be the same as one of the types that this variant can
3676 // hold. Note that in C++11 mode, this method does not participate in
3677 // overload resolution if it would lead to ambiguity with the move
3678 // constructor that does not take an allocator (below) or with the
3679 // constructor taking a 'valueOrAllocator' (above).
3680
3681 template <class TYPE>
3682#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3683 Variant10(TYPE&& value,
3684 typename bsl::enable_if<
3685 !bsl::is_same<
3686 SelfType,
3687 typename bsl::remove_const<
3688 typename bsl::remove_reference<TYPE>::type>::type>::value,
3689 bslma::Allocator>::type *basicAllocator);
3690#else
3691 Variant10(bslmf::MovableRef<TYPE> value,
3692 bslma::Allocator *basicAllocator);
3693#endif
3694 // Create a variant object having the specified 'value' of template
3695 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
3696 // memory. If 'basicAllocator' is 0, the currently installed default
3697 // allocator is used. The contents of 'value' are moved to the
3698 // newly-created object with 'value' left in a valid but unspecified
3699 // state. 'TYPE' must be the same as one of the types that this
3700 // variant can hold. Note that in C++11 mode, this method does not
3701 // participate in overload resolution if it would lead to ambiguity
3702 // with the move constructor that takes an allocator (below).
3703
3704 /// Create a variant object having the type and value of the specified
3705 /// `original` variant. Optionally specify a `basicAllocator` used to
3706 /// supply memory. If `basicAllocator` is 0, the currently installed
3707 /// default allocator is used.
3708 Variant10(const Variant10& original, bslma::Allocator *basicAllocator = 0);
3709
3710 /// Create a variant object having the type and value of the specified
3711 /// `original` object by moving the contents of `original` to the
3712 /// newly-created object. The allocator associated with `original` (if
3713 /// any) is propagated for use in the newly-created object. `original`
3714 /// is left in a valid but unspecified state.
3715 Variant10(bslmf::MovableRef<Variant10> original);
3716
3717 /// Create a variant object having the type and value of the specified
3718 /// `original` object that uses the specified `basicAllocator` to supply
3719 /// memory. If `basicAllocator` is 0, the currently installed default
3720 /// allocator is used. The contents of `original` are moved to the
3721 /// newly-created object with `original` left in a valid but unspecified
3722 /// state.
3723 Variant10(bslmf::MovableRef<Variant10> original,
3724 bslma::Allocator *basicAllocator);
3725
3726 // MANIPULATORS
3727
3728 /// Assign to this object the specified `value` of template parameter
3729 /// `TYPE`, and return a reference providing modifiable access to this
3730 /// object. The value currently held by this variant (if any) is
3731 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
3732 /// must be the same as one of the types that this variant can hold.
3733 template <class TYPE>
3734 Variant10& operator=(const TYPE& value);
3735
3736 template <class TYPE>
3737#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3738 typename bsl::enable_if<
3739 !bsl::is_same<SelfType,
3740 typename bsl::remove_cvref<TYPE>::type>::value,
3741 SelfType>::type&
3742 operator=(TYPE&& value);
3743#else
3744 Variant10&
3745 operator=(bslmf::MovableRef<TYPE> value);
3746#endif
3747 // Assign to this object the specified 'value' of template parameter
3748 // 'TYPE', and return a reference providing modifiable access to this
3749 // object. The contents of 'value' are moved to this object with
3750 // 'value' left in a valid but unspecified state. The value currently
3751 // held by this variant (if any) is destroyed if that value's type is
3752 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
3753 // that this variant can hold. Note that in C++11 mode, this method
3754 // does not participate in overload resolution if it would lead to
3755 // ambiguity with the move-assignment operator (below).
3756
3757 /// Assign to this object the type and value currently held by the
3758 /// specified `rhs` object, and return a reference providing modifiable
3759 /// access to this object. The value currently held by this variant
3760 /// (if any) is destroyed if that value's type is not the same as the
3761 /// type held by the `rhs` object.
3762 Variant10& operator=(const Variant10& rhs);
3763
3764 /// Assign to this object the type and value currently held by the
3765 /// specified `rhs` object, and return a reference providing modifiable
3766 /// access to this object. The value currently held by this variant
3767 /// (if any) is destroyed if that value's type is not the same as the
3768 /// type held by the `rhs` object. The contents of `rhs` are either
3769 /// move-inserted into or move-assigned to this object with `rhs` left
3770 /// in a valid but unspecified state.
3771 Variant10& operator=(bslmf::MovableRef<Variant10> rhs);
3772};
3773
3774 // ====================
3775 // class Variant11<...>
3776 // ====================
3777
3778/// This class is a "specialization" of `Variant` for a fixed number (11) of
3779/// types. Its 11 template arguments *must* all be specified (none are
3780/// defaulted to `bslmf::Nil`). It provides the same functionality as
3781/// `Variant<A1, A2, ..., A11>`.
3782template <class A1, class A2, class A3, class A4, class A5, class A6,
3783 class A7, class A8, class A9, class A10, class A11>
3784class Variant11 : public VariantImp<typename bslmf::TypeList11<
3785 A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::ListType> {
3786
3787 // PRIVATE TYPES
3788 typedef VariantImp<typename bslmf::TypeList11<A1, A2, A3, A4, A5, A6, A7,
3789 A8, A9, A10,
3790 A11>::ListType> Imp;
3791
3792 /// `SelfType` is an alias to this class.
3793 typedef Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
3794 A11> SelfType;
3795
3796 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
3797 typedef bslmf::MovableRefUtil MoveUtil;
3798
3799 public:
3800 // TRAITS
3803 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
3806 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
3809 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
3810 BSLMF_NESTED_TRAIT_DECLARATION(Variant11, HasPrintMethod);
3811
3812 // CREATORS
3813
3814 /// Create a variant object in the unset state that uses the currently
3815 /// installed default allocator to supply memory.
3816 Variant11();
3817
3818 /// Create a variant object with the specified `valueOrAllocator` that
3819 /// can be either a value of a type that the variant can hold or an
3820 /// allocator to supply memory. If `valueOrAllocator` is not a
3821 /// `bslma::Allocator *`, then the variant will hold the value and type
3822 /// of `valueOrAllocator`, and use the currently installed default
3823 /// allocator to supply memory. Otherwise, the variant will be unset
3824 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
3825 /// must be the same as one of the types that this variant can hold or
3826 /// be convertible to `bslma::Allocator *`. Note that this
3827 /// parameterized constructor is defined instead of two constructors
3828 /// (one taking a `bslma::Allocator *` and the other not) because
3829 /// template parameter arguments are always a better match than
3830 /// derived-to-base conversion (a concrete allocator pointer converted
3831 /// to `bslma::Allocator *`).
3832 template <class TYPE_OR_ALLOCATOR>
3833 explicit
3834 Variant11(const TYPE_OR_ALLOCATOR& valueOrAllocator);
3835
3836 /// Create a variant object having the specified `value` of template
3837 /// parameter `TYPE` and that uses the specified `basicAllocator` to
3838 /// supply memory. If `basicAllocator` is 0, the currently installed
3839 /// default allocator is used. `TYPE` must be the same as one of the
3840 /// types that this variant can hold.
3841 template <class TYPE>
3842 Variant11(const TYPE& value, bslma::Allocator *basicAllocator);
3843
3844 template <class TYPE>
3845 explicit
3846#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3847 Variant11(TYPE&& value,
3848 typename bsl::enable_if<
3849 !bsl::is_same<
3850 SelfType,
3851 typename bsl::remove_const<
3852 typename bsl::remove_reference<TYPE>::type>::type>::value
3853 &&
3855 void>::type * = 0);
3856#else
3857 Variant11(bslmf::MovableRef<TYPE> value);
3858#endif
3859 // Create a variant object having the specified 'value' of template
3860 // parameter 'TYPE' by moving the contents of 'value' to the
3861 // newly-created object. Use the currently installed default allocator
3862 // to supply memory. 'value' is left in a valid but unspecified state.
3863 // 'TYPE' must be the same as one of the types that this variant can
3864 // hold. Note that in C++11 mode, this method does not participate in
3865 // overload resolution if it would lead to ambiguity with the move
3866 // constructor that does not take an allocator (below) or with the
3867 // constructor taking a 'valueOrAllocator' (above).
3868
3869 template <class TYPE>
3870#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3871 Variant11(TYPE&& value,
3872 typename bsl::enable_if<
3873 !bsl::is_same<
3874 SelfType,
3875 typename bsl::remove_const<
3876 typename bsl::remove_reference<TYPE>::type>::type>::value,
3877 bslma::Allocator>::type *basicAllocator);
3878#else
3879 Variant11(bslmf::MovableRef<TYPE> value,
3880 bslma::Allocator *basicAllocator);
3881#endif
3882 // Create a variant object having the specified 'value' of template
3883 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
3884 // memory. If 'basicAllocator' is 0, the currently installed default
3885 // allocator is used. The contents of 'value' are moved to the
3886 // newly-created object with 'value' left in a valid but unspecified
3887 // state. 'TYPE' must be the same as one of the types that this
3888 // variant can hold. Note that in C++11 mode, this method does not
3889 // participate in overload resolution if it would lead to ambiguity
3890 // with the move constructor that takes an allocator (below).
3891
3892 /// Create a variant object having the type and value of the specified
3893 /// `original` variant. Optionally specify a `basicAllocator` used to
3894 /// supply memory. If `basicAllocator` is 0, the currently installed
3895 /// default allocator is used.
3896 Variant11(const Variant11& original, bslma::Allocator *basicAllocator = 0);
3897
3898 /// Create a variant object having the type and value of the specified
3899 /// `original` object by moving the contents of `original` to the
3900 /// newly-created object. The allocator associated with `original` (if
3901 /// any) is propagated for use in the newly-created object. `original`
3902 /// is left in a valid but unspecified state.
3903 Variant11(bslmf::MovableRef<Variant11> original);
3904
3905 /// Create a variant object having the type and value of the specified
3906 /// `original` object that uses the specified `basicAllocator` to supply
3907 /// memory. If `basicAllocator` is 0, the currently installed default
3908 /// allocator is used. The contents of `original` are moved to the
3909 /// newly-created object with `original` left in a valid but unspecified
3910 /// state.
3911 Variant11(bslmf::MovableRef<Variant11> original,
3912 bslma::Allocator *basicAllocator);
3913
3914 // MANIPULATORS
3915
3916 /// Assign to this object the specified `value` of template parameter
3917 /// `TYPE`, and return a reference providing modifiable access to this
3918 /// object. The value currently held by this variant (if any) is
3919 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
3920 /// must be the same as one of the types that this variant can hold.
3921 template <class TYPE>
3922 Variant11& operator=(const TYPE& value);
3923
3924 template <class TYPE>
3925#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
3926 typename bsl::enable_if<
3927 !bsl::is_same<SelfType,
3928 typename bsl::remove_cvref<TYPE>::type>::value,
3929 SelfType>::type&
3930 operator=(TYPE&& value);
3931#else
3932 Variant11&
3933 operator=(bslmf::MovableRef<TYPE> value);
3934#endif
3935 // Assign to this object the specified 'value' of template parameter
3936 // 'TYPE', and return a reference providing modifiable access to this
3937 // object. The contents of 'value' are moved to this object with
3938 // 'value' left in a valid but unspecified state. The value currently
3939 // held by this variant (if any) is destroyed if that value's type is
3940 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
3941 // that this variant can hold. Note that in C++11 mode, this method
3942 // does not participate in overload resolution if it would lead to
3943 // ambiguity with the move-assignment operator (below).
3944
3945 /// Assign to this object the type and value currently held by the
3946 /// specified `rhs` object, and return a reference providing modifiable
3947 /// access to this object. The value currently held by this variant
3948 /// (if any) is destroyed if that value's type is not the same as the
3949 /// type held by the `rhs` object.
3950 Variant11& operator=(const Variant11& rhs);
3951
3952 /// Assign to this object the type and value currently held by the
3953 /// specified `rhs` object, and return a reference providing modifiable
3954 /// access to this object. The value currently held by this variant
3955 /// (if any) is destroyed if that value's type is not the same as the
3956 /// type held by the `rhs` object. The contents of `rhs` are either
3957 /// move-inserted into or move-assigned to this object with `rhs` left
3958 /// in a valid but unspecified state.
3959 Variant11& operator=(bslmf::MovableRef<Variant11> rhs);
3960};
3961
3962 // ====================
3963 // class Variant12<...>
3964 // ====================
3965
3966/// This class is a "specialization" of `Variant` for a fixed number (12) of
3967/// types. Its 12 template arguments *must* all be specified (none are
3968/// defaulted to `bslmf::Nil`). It provides the same functionality as
3969/// `Variant<A1, A2, ..., A12>`.
3970template <class A1, class A2, class A3, class A4, class A5, class A6,
3971 class A7, class A8, class A9, class A10, class A11, class A12>
3972class Variant12 : public VariantImp<typename bslmf::TypeList12<
3973 A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::ListType> {
3974
3975 // PRIVATE TYPES
3976 typedef VariantImp<typename bslmf::TypeList12<A1, A2, A3, A4, A5, A6,
3977 A7, A8, A9, A10, A11,
3978 A12>::ListType> Imp;
3979
3980 /// `SelfType` is an alias to this class.
3981 typedef Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
3982 A11, A12> SelfType;
3983
3984 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
3985 typedef bslmf::MovableRefUtil MoveUtil;
3986
3987 public:
3988 // TRAITS
3991 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
3994 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
3997 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
3998 BSLMF_NESTED_TRAIT_DECLARATION(Variant12, HasPrintMethod);
3999
4000 // CREATORS
4001
4002 /// Create a variant object in the unset state that uses the currently
4003 /// installed default allocator to supply memory.
4004 Variant12();
4005
4006 /// Create a variant object with the specified `valueOrAllocator` that
4007 /// can be either a value of a type that the variant can hold or an
4008 /// allocator to supply memory. If `valueOrAllocator` is not a
4009 /// `bslma::Allocator *`, then the variant will hold the value and type
4010 /// of `valueOrAllocator`, and use the currently installed default
4011 /// allocator to supply memory. Otherwise, the variant will be unset
4012 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
4013 /// must be the same as one of the types that this variant can hold or
4014 /// be convertible to `bslma::Allocator *`. Note that this
4015 /// parameterized constructor is defined instead of two constructors
4016 /// (one taking a `bslma::Allocator *` and the other not) because
4017 /// template parameter arguments are always a better match than
4018 /// derived-to-base conversion (a concrete allocator pointer converted
4019 /// to `bslma::Allocator *`).
4020 template <class TYPE_OR_ALLOCATOR>
4021 explicit
4022 Variant12(const TYPE_OR_ALLOCATOR& valueOrAllocator);
4023
4024 /// Create a variant object having the specified `value` of template
4025 /// parameter `TYPE` and that uses the specified `basicAllocator` to
4026 /// supply memory. If `basicAllocator` is 0, the currently installed
4027 /// default allocator is used. `TYPE` must be the same as one of the
4028 /// types that this variant can hold.
4029 template <class TYPE>
4030 Variant12(const TYPE& value, bslma::Allocator *basicAllocator);
4031
4032 template <class TYPE>
4033 explicit
4034#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4035 Variant12(TYPE&& value,
4036 typename bsl::enable_if<
4037 !bsl::is_same<
4038 SelfType,
4039 typename bsl::remove_const<
4040 typename bsl::remove_reference<TYPE>::type>::type>::value
4041 &&
4043 void>::type * = 0);
4044#else
4045 Variant12(bslmf::MovableRef<TYPE> value);
4046#endif
4047 // Create a variant object having the specified 'value' of template
4048 // parameter 'TYPE' by moving the contents of 'value' to the
4049 // newly-created object. Use the currently installed default allocator
4050 // to supply memory. 'value' is left in a valid but unspecified state.
4051 // 'TYPE' must be the same as one of the types that this variant can
4052 // hold. Note that in C++11 mode, this method does not participate in
4053 // overload resolution if it would lead to ambiguity with the move
4054 // constructor that does not take an allocator (below) or with the
4055 // constructor taking a 'valueOrAllocator' (above).
4056
4057 template <class TYPE>
4058#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4059 Variant12(TYPE&& value,
4060 typename bsl::enable_if<
4061 !bsl::is_same<
4062 SelfType,
4063 typename bsl::remove_const<
4064 typename bsl::remove_reference<TYPE>::type>::type>::value,
4065 bslma::Allocator>::type *basicAllocator);
4066#else
4067 Variant12(bslmf::MovableRef<TYPE> value,
4068 bslma::Allocator *basicAllocator);
4069#endif
4070 // Create a variant object having the specified 'value' of template
4071 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
4072 // memory. If 'basicAllocator' is 0, the currently installed default
4073 // allocator is used. The contents of 'value' are moved to the
4074 // newly-created object with 'value' left in a valid but unspecified
4075 // state. 'TYPE' must be the same as one of the types that this
4076 // variant can hold. Note that in C++11 mode, this method does not
4077 // participate in overload resolution if it would lead to ambiguity
4078 // with the move constructor that takes an allocator (below).
4079
4080 /// Create a variant object having the type and value of the specified
4081 /// `original` variant. Optionally specify a `basicAllocator` used to
4082 /// supply memory. If `basicAllocator` is 0, the currently installed
4083 /// default allocator is used.
4084 Variant12(const Variant12& original, bslma::Allocator *basicAllocator = 0);
4085
4086 /// Create a variant object having the type and value of the specified
4087 /// `original` object by moving the contents of `original` to the
4088 /// newly-created object. The allocator associated with `original` (if
4089 /// any) is propagated for use in the newly-created object. `original`
4090 /// is left in a valid but unspecified state.
4091 Variant12(bslmf::MovableRef<Variant12> original);
4092
4093 /// Create a variant object having the type and value of the specified
4094 /// `original` object that uses the specified `basicAllocator` to supply
4095 /// memory. If `basicAllocator` is 0, the currently installed default
4096 /// allocator is used. The contents of `original` are moved to the
4097 /// newly-created object with `original` left in a valid but unspecified
4098 /// state.
4099 Variant12(bslmf::MovableRef<Variant12> original,
4100 bslma::Allocator *basicAllocator);
4101
4102 // MANIPULATORS
4103
4104 /// Assign to this object the specified `value` of template parameter
4105 /// `TYPE`, and return a reference providing modifiable access to this
4106 /// object. The value currently held by this variant (if any) is
4107 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
4108 /// must be the same as one of the types that this variant can hold.
4109 template <class TYPE>
4110 Variant12& operator=(const TYPE& value);
4111
4112 template <class TYPE>
4113#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4114 typename bsl::enable_if<
4115 !bsl::is_same<SelfType,
4116 typename bsl::remove_cvref<TYPE>::type>::value,
4117 SelfType>::type&
4118 operator=(TYPE&& value);
4119#else
4120 Variant12&
4121 operator=(bslmf::MovableRef<TYPE> value);
4122#endif
4123 // Assign to this object the specified 'value' of template parameter
4124 // 'TYPE', and return a reference providing modifiable access to this
4125 // object. The contents of 'value' are moved to this object with
4126 // 'value' left in a valid but unspecified state. The value currently
4127 // held by this variant (if any) is destroyed if that value's type is
4128 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
4129 // that this variant can hold. Note that in C++11 mode, this method
4130 // does not participate in overload resolution if it would lead to
4131 // ambiguity with the move-assignment operator (below).
4132
4133 /// Assign to this object the type and value currently held by the
4134 /// specified `rhs` object, and return a reference providing modifiable
4135 /// access to this object. The value currently held by this variant
4136 /// (if any) is destroyed if that value's type is not the same as the
4137 /// type held by the `rhs` object.
4138 Variant12& operator=(const Variant12& rhs);
4139
4140 /// Assign to this object the type and value currently held by the
4141 /// specified `rhs` object, and return a reference providing modifiable
4142 /// access to this object. The value currently held by this variant
4143 /// (if any) is destroyed if that value's type is not the same as the
4144 /// type held by the `rhs` object. The contents of `rhs` are either
4145 /// move-inserted into or move-assigned to this object with `rhs` left
4146 /// in a valid but unspecified state.
4147 Variant12& operator=(bslmf::MovableRef<Variant12> rhs);
4148};
4149
4150 // ====================
4151 // class Variant13<...>
4152 // ====================
4153
4154/// This class is a "specialization" of `Variant` for a fixed number (13) of
4155/// types. Its 13 template arguments *must* all be specified (none are
4156/// defaulted to `bslmf::Nil`). It provides the same functionality as
4157/// `Variant<A1, A2, ..., A13>`.
4158template <class A1, class A2, class A3, class A4, class A5, class A6,
4159 class A7, class A8, class A9, class A10, class A11, class A12,
4160 class A13>
4161class Variant13 : public VariantImp<typename bslmf::TypeList13<
4162 A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::ListType> {
4163
4164 // PRIVATE TYPES
4165 typedef VariantImp<typename bslmf::TypeList13<A1, A2, A3, A4, A5, A6,
4166 A7, A8, A9, A10, A11, A12,
4167 A13>::ListType> Imp;
4168
4169 /// `SelfType` is an alias to this class.
4170 typedef Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9,
4171 A10, A11, A12, A13> SelfType;
4172
4173 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
4174 typedef bslmf::MovableRefUtil MoveUtil;
4175
4176 public:
4177 // TRAITS
4180 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
4183 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
4186 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
4187 BSLMF_NESTED_TRAIT_DECLARATION(Variant13, HasPrintMethod);
4188
4189 // CREATORS
4190
4191 /// Create a variant object in the unset state that uses the currently
4192 /// installed default allocator to supply memory.
4193 Variant13();
4194
4195 /// Create a variant object with the specified `valueOrAllocator` that
4196 /// can be either a value of a type that the variant can hold or an
4197 /// allocator to supply memory. If `valueOrAllocator` is not a
4198 /// `bslma::Allocator *`, then the variant will hold the value and type
4199 /// of `valueOrAllocator`, and use the currently installed default
4200 /// allocator to supply memory. Otherwise, the variant will be unset
4201 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
4202 /// must be the same as one of the types that this variant can hold or
4203 /// be convertible to `bslma::Allocator *`. Note that this
4204 /// parameterized constructor is defined instead of two constructors
4205 /// (one taking a `bslma::Allocator *` and the other not) because
4206 /// template parameter arguments are always a better match than
4207 /// derived-to-base conversion (a concrete allocator pointer converted
4208 /// to `bslma::Allocator *`).
4209 template <class TYPE_OR_ALLOCATOR>
4210 explicit
4211 Variant13(const TYPE_OR_ALLOCATOR& valueOrAllocator);
4212
4213 /// Create a variant object having the specified `value` of template
4214 /// parameter `TYPE` and that uses the specified `basicAllocator` to
4215 /// supply memory. If `basicAllocator` is 0, the currently installed
4216 /// default allocator is used. `TYPE` must be the same as one of the
4217 /// types that this variant can hold.
4218 template <class TYPE>
4219 Variant13(const TYPE& value, bslma::Allocator *basicAllocator);
4220
4221 template <class TYPE>
4222 explicit
4223#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4224 Variant13(TYPE&& value,
4225 typename bsl::enable_if<
4226 !bsl::is_same<
4227 SelfType,
4228 typename bsl::remove_const<
4229 typename bsl::remove_reference<TYPE>::type>::type>::value
4230 &&
4232 void>::type * = 0);
4233#else
4234 Variant13(bslmf::MovableRef<TYPE> value);
4235#endif
4236 // Create a variant object having the specified 'value' of template
4237 // parameter 'TYPE' by moving the contents of 'value' to the
4238 // newly-created object. Use the currently installed default allocator
4239 // to supply memory. 'value' is left in a valid but unspecified state.
4240 // 'TYPE' must be the same as one of the types that this variant can
4241 // hold. Note that in C++11 mode, this method does not participate in
4242 // overload resolution if it would lead to ambiguity with the move
4243 // constructor that does not take an allocator (below) or with the
4244 // constructor taking a 'valueOrAllocator' (above).
4245
4246 template <class TYPE>
4247#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4248 Variant13(TYPE&& value,
4249 typename bsl::enable_if<
4250 !bsl::is_same<
4251 SelfType,
4252 typename bsl::remove_const<
4253 typename bsl::remove_reference<TYPE>::type>::type>::value,
4254 bslma::Allocator>::type *basicAllocator);
4255#else
4256 Variant13(bslmf::MovableRef<TYPE> value,
4257 bslma::Allocator *basicAllocator);
4258#endif
4259 // Create a variant object having the specified 'value' of template
4260 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
4261 // memory. If 'basicAllocator' is 0, the currently installed default
4262 // allocator is used. The contents of 'value' are moved to the
4263 // newly-created object with 'value' left in a valid but unspecified
4264 // state. 'TYPE' must be the same as one of the types that this
4265 // variant can hold. Note that in C++11 mode, this method does not
4266 // participate in overload resolution if it would lead to ambiguity
4267 // with the move constructor that takes an allocator (below).
4268
4269 /// Create a variant object having the type and value of the specified
4270 /// `original` variant. Optionally specify a `basicAllocator` used to
4271 /// supply memory. If `basicAllocator` is 0, the currently installed
4272 /// default allocator is used.
4273 Variant13(const Variant13& original, bslma::Allocator *basicAllocator = 0);
4274
4275 /// Create a variant object having the type and value of the specified
4276 /// `original` object by moving the contents of `original` to the
4277 /// newly-created object. The allocator associated with `original` (if
4278 /// any) is propagated for use in the newly-created object. `original`
4279 /// is left in a valid but unspecified state.
4280 Variant13(bslmf::MovableRef<Variant13> original);
4281
4282 /// Create a variant object having the type and value of the specified
4283 /// `original` object that uses the specified `basicAllocator` to supply
4284 /// memory. If `basicAllocator` is 0, the currently installed default
4285 /// allocator is used. The contents of `original` are moved to the
4286 /// newly-created object with `original` left in a valid but unspecified
4287 /// state.
4288 Variant13(bslmf::MovableRef<Variant13> original,
4289 bslma::Allocator *basicAllocator);
4290
4291 // MANIPULATORS
4292
4293 /// Assign to this object the specified `value` of template parameter
4294 /// `TYPE`, and return a reference providing modifiable access to this
4295 /// object. The value currently held by this variant (if any) is
4296 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
4297 /// must be the same as one of the types that this variant can hold.
4298 template <class TYPE>
4299 Variant13& operator=(const TYPE& value);
4300
4301 template <class TYPE>
4302#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4303 typename bsl::enable_if<
4304 !bsl::is_same<SelfType,
4305 typename bsl::remove_cvref<TYPE>::type>::value,
4306 SelfType>::type&
4307 operator=(TYPE&& value);
4308#else
4309 Variant13&
4310 operator=(bslmf::MovableRef<TYPE> value);
4311#endif
4312 // Assign to this object the specified 'value' of template parameter
4313 // 'TYPE', and return a reference providing modifiable access to this
4314 // object. The contents of 'value' are moved to this object with
4315 // 'value' left in a valid but unspecified state. The value currently
4316 // held by this variant (if any) is destroyed if that value's type is
4317 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
4318 // that this variant can hold. Note that in C++11 mode, this method
4319 // does not participate in overload resolution if it would lead to
4320 // ambiguity with the move-assignment operator (below).
4321
4322 /// Assign to this object the type and value currently held by the
4323 /// specified `rhs` object, and return a reference providing modifiable
4324 /// access to this object. The value currently held by this variant
4325 /// (if any) is destroyed if that value's type is not the same as the
4326 /// type held by the `rhs` object.
4327 Variant13& operator=(const Variant13& rhs);
4328
4329 /// Assign to this object the type and value currently held by the
4330 /// specified `rhs` object, and return a reference providing modifiable
4331 /// access to this object. The value currently held by this variant
4332 /// (if any) is destroyed if that value's type is not the same as the
4333 /// type held by the `rhs` object. The contents of `rhs` are either
4334 /// move-inserted into or move-assigned to this object with `rhs` left
4335 /// in a valid but unspecified state.
4336 Variant13& operator=(bslmf::MovableRef<Variant13> rhs);
4337};
4338
4339 // ====================
4340 // class Variant14<...>
4341 // ====================
4342
4343/// This class is a "specialization" of `Variant` for a fixed number (14) of
4344/// types. Its 14 template arguments *must* all be specified (none are
4345/// defaulted to `bslmf::Nil`). It provides the same functionality as
4346/// `Variant<A1, A2, ..., A14>`.
4347template <class A1, class A2, class A3, class A4, class A5, class A6,
4348 class A7, class A8, class A9, class A10, class A11, class A12,
4349 class A13, class A14>
4350class Variant14 : public VariantImp<typename bslmf::TypeList14<
4351 A1, A2, A3, A4, A5,
4352 A6, A7, A8, A9, A10,
4353 A11, A12, A13, A14>::ListType> {
4354
4355 // PRIVATE TYPES
4356 typedef VariantImp<typename bslmf::TypeList14<A1, A2, A3, A4, A5, A6,
4357 A7, A8, A9, A10, A11, A12,
4358 A13,
4359 A14>::ListType> Imp;
4360
4361 /// `SelfType` is an alias to this class.
4362 typedef Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9,
4363 A10, A11, A12, A13, A14> SelfType;
4364
4365 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
4366 typedef bslmf::MovableRefUtil MoveUtil;
4367
4368 public:
4369 // TRAITS
4372 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
4375 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
4378 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
4379 BSLMF_NESTED_TRAIT_DECLARATION(Variant14, HasPrintMethod);
4380
4381 // CREATORS
4382
4383 /// Create a variant object in the unset state that uses the currently
4384 /// installed default allocator to supply memory.
4385 Variant14();
4386
4387 /// Create a variant object with the specified `valueOrAllocator` that
4388 /// can be either a value of a type that the variant can hold or an
4389 /// allocator to supply memory. If `valueOrAllocator` is not a
4390 /// `bslma::Allocator *`, then the variant will hold the value and type
4391 /// of `valueOrAllocator`, and use the currently installed default
4392 /// allocator to supply memory. Otherwise, the variant will be unset
4393 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
4394 /// must be the same as one of the types that this variant can hold or
4395 /// be convertible to `bslma::Allocator *`. Note that this
4396 /// parameterized constructor is defined instead of two constructors
4397 /// (one taking a `bslma::Allocator *` and the other not) because
4398 /// template parameter arguments are always a better match than
4399 /// derived-to-base conversion (a concrete allocator pointer converted
4400 /// to `bslma::Allocator *`).
4401 template <class TYPE_OR_ALLOCATOR>
4402 explicit
4403 Variant14(const TYPE_OR_ALLOCATOR& valueOrAllocator);
4404
4405 /// Create a variant object having the specified `value` of template
4406 /// parameter `TYPE` and that uses the specified `basicAllocator` to
4407 /// supply memory. If `basicAllocator` is 0, the currently installed
4408 /// default allocator is used. `TYPE` must be the same as one of the
4409 /// types that this variant can hold.
4410 template <class TYPE>
4411 Variant14(const TYPE& value, bslma::Allocator *basicAllocator);
4412
4413 template <class TYPE>
4414 explicit
4415#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4416 Variant14(TYPE&& value,
4417 typename bsl::enable_if<
4418 !bsl::is_same<
4419 SelfType,
4420 typename bsl::remove_const<
4421 typename bsl::remove_reference<TYPE>::type>::type>::value
4422 &&
4424 void>::type * = 0);
4425#else
4426 Variant14(bslmf::MovableRef<TYPE> value);
4427#endif
4428 // Create a variant object having the specified 'value' of template
4429 // parameter 'TYPE' by moving the contents of 'value' to the
4430 // newly-created object. Use the currently installed default allocator
4431 // to supply memory. 'value' is left in a valid but unspecified state.
4432 // 'TYPE' must be the same as one of the types that this variant can
4433 // hold. Note that in C++11 mode, this method does not participate in
4434 // overload resolution if it would lead to ambiguity with the move
4435 // constructor that does not take an allocator (below) or with the
4436 // constructor taking a 'valueOrAllocator' (above).
4437
4438 template <class TYPE>
4439#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4440 Variant14(TYPE&& value,
4441 typename bsl::enable_if<
4442 !bsl::is_same<
4443 SelfType,
4444 typename bsl::remove_const<
4445 typename bsl::remove_reference<TYPE>::type>::type>::value,
4446 bslma::Allocator>::type *basicAllocator);
4447#else
4448 Variant14(bslmf::MovableRef<TYPE> value,
4449 bslma::Allocator *basicAllocator);
4450#endif
4451 // Create a variant object having the specified 'value' of template
4452 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
4453 // memory. If 'basicAllocator' is 0, the currently installed default
4454 // allocator is used. The contents of 'value' are moved to the
4455 // newly-created object with 'value' left in a valid but unspecified
4456 // state. 'TYPE' must be the same as one of the types that this
4457 // variant can hold. Note that in C++11 mode, this method does not
4458 // participate in overload resolution if it would lead to ambiguity
4459 // with the move constructor that takes an allocator (below).
4460
4461 /// Create a variant object having the type and value of the specified
4462 /// `original` variant. Optionally specify a `basicAllocator` used to
4463 /// supply memory. If `basicAllocator` is 0, the currently installed
4464 /// default allocator is used.
4465 Variant14(const Variant14& original, bslma::Allocator *basicAllocator = 0);
4466
4467 /// Create a variant object having the type and value of the specified
4468 /// `original` object by moving the contents of `original` to the
4469 /// newly-created object. The allocator associated with `original` (if
4470 /// any) is propagated for use in the newly-created object. `original`
4471 /// is left in a valid but unspecified state.
4472 Variant14(bslmf::MovableRef<Variant14> original);
4473
4474 /// Create a variant object having the type and value of the specified
4475 /// `original` object that uses the specified `basicAllocator` to supply
4476 /// memory. If `basicAllocator` is 0, the currently installed default
4477 /// allocator is used. The contents of `original` are moved to the
4478 /// newly-created object with `original` left in a valid but unspecified
4479 /// state.
4480 Variant14(bslmf::MovableRef<Variant14> original,
4481 bslma::Allocator *basicAllocator);
4482
4483 // MANIPULATORS
4484
4485 /// Assign to this object the specified `value` of template parameter
4486 /// `TYPE`, and return a reference providing modifiable access to this
4487 /// object. The value currently held by this variant (if any) is
4488 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
4489 /// must be the same as one of the types that this variant can hold.
4490 template <class TYPE>
4491 Variant14& operator=(const TYPE& value);
4492
4493 template <class TYPE>
4494#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4495 typename bsl::enable_if<
4496 !bsl::is_same<SelfType,
4497 typename bsl::remove_cvref<TYPE>::type>::value,
4498 SelfType>::type&
4499 operator=(TYPE&& value);
4500#else
4501 Variant14&
4502 operator=(bslmf::MovableRef<TYPE> value);
4503#endif
4504 // Assign to this object the specified 'value' of template parameter
4505 // 'TYPE', and return a reference providing modifiable access to this
4506 // object. The contents of 'value' are moved to this object with
4507 // 'value' left in a valid but unspecified state. The value currently
4508 // held by this variant (if any) is destroyed if that value's type is
4509 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
4510 // that this variant can hold. Note that in C++11 mode, this method
4511 // does not participate in overload resolution if it would lead to
4512 // ambiguity with the move-assignment operator (below).
4513
4514 /// Assign to this object the type and value currently held by the
4515 /// specified `rhs` object, and return a reference providing modifiable
4516 /// access to this object. The value currently held by this variant
4517 /// (if any) is destroyed if that value's type is not the same as the
4518 /// type held by the `rhs` object.
4519 Variant14& operator=(const Variant14& rhs);
4520
4521 /// Assign to this object the type and value currently held by the
4522 /// specified `rhs` object, and return a reference providing modifiable
4523 /// access to this object. The value currently held by this variant
4524 /// (if any) is destroyed if that value's type is not the same as the
4525 /// type held by the `rhs` object. The contents of `rhs` are either
4526 /// move-inserted into or move-assigned to this object with `rhs` left
4527 /// in a valid but unspecified state.
4528 Variant14& operator=(bslmf::MovableRef<Variant14> rhs);
4529};
4530
4531 // ====================
4532 // class Variant15<...>
4533 // ====================
4534
4535/// This class is a "specialization" of `Variant` for a fixed number (15) of
4536/// types. Its 15 template arguments *must* all be specified (none are
4537/// defaulted to `bslmf::Nil`). It provides the same functionality as
4538/// `Variant<A1, A2, ..., A15>`.
4539template <class A1, class A2, class A3, class A4, class A5, class A6,
4540 class A7, class A8, class A9, class A10, class A11, class A12,
4541 class A13, class A14, class A15>
4542class Variant15 : public VariantImp<typename bslmf::TypeList15<
4543 A1, A2, A3, A4, A5,
4544 A6, A7, A8, A9, A10,
4545 A11, A12, A13, A14, A15>::ListType> {
4546
4547 // PRIVATE TYPES
4548 typedef VariantImp<typename bslmf::TypeList15<A1, A2, A3, A4, A5, A6,
4549 A7, A8, A9, A10, A11, A12,
4550 A13, A14,
4551 A15>::ListType> Imp;
4552
4553 /// `SelfType` is an alias to this class.
4554 typedef Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9,
4555 A10, A11, A12, A13, A14, A15> SelfType;
4556
4557 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
4558 typedef bslmf::MovableRefUtil MoveUtil;
4559
4560 public:
4561 // TRAITS
4564 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
4567 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
4570 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
4571 BSLMF_NESTED_TRAIT_DECLARATION(Variant15, HasPrintMethod);
4572
4573 // CREATORS
4574
4575 /// Create a variant object in the unset state that uses the currently
4576 /// installed default allocator to supply memory.
4577 Variant15();
4578
4579 /// Create a variant object with the specified `valueOrAllocator` that
4580 /// can be either a value of a type that the variant can hold or an
4581 /// allocator to supply memory. If `valueOrAllocator` is not a
4582 /// `bslma::Allocator *`, then the variant will hold the value and type
4583 /// of `valueOrAllocator`, and use the currently installed default
4584 /// allocator to supply memory. Otherwise, the variant will be unset
4585 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
4586 /// must be the same as one of the types that this variant can hold or
4587 /// be convertible to `bslma::Allocator *`. Note that this
4588 /// parameterized constructor is defined instead of two constructors
4589 /// (one taking a `bslma::Allocator *` and the other not) because
4590 /// template parameter arguments are always a better match than
4591 /// derived-to-base conversion (a concrete allocator pointer converted
4592 /// to `bslma::Allocator *`).
4593 template <class TYPE_OR_ALLOCATOR>
4594 explicit
4595 Variant15(const TYPE_OR_ALLOCATOR& valueOrAllocator);
4596
4597 /// Create a variant object having the specified `value` of template
4598 /// parameter `TYPE` and that uses the specified `basicAllocator` to
4599 /// supply memory. If `basicAllocator` is 0, the currently installed
4600 /// default allocator is used. `TYPE` must be the same as one of the
4601 /// types that this variant can hold.
4602 template <class TYPE>
4603 Variant15(const TYPE& value, bslma::Allocator *basicAllocator);
4604
4605 template <class TYPE>
4606 explicit
4607#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4608 Variant15(TYPE&& value,
4609 typename bsl::enable_if<
4610 !bsl::is_same<
4611 SelfType,
4612 typename bsl::remove_const<
4613 typename bsl::remove_reference<TYPE>::type>::type>::value
4614 &&
4616 void>::type * = 0);
4617#else
4618 Variant15(bslmf::MovableRef<TYPE> value);
4619#endif
4620 // Create a variant object having the specified 'value' of template
4621 // parameter 'TYPE' by moving the contents of 'value' to the
4622 // newly-created object. Use the currently installed default allocator
4623 // to supply memory. 'value' is left in a valid but unspecified state.
4624 // 'TYPE' must be the same as one of the types that this variant can
4625 // hold. Note that in C++11 mode, this method does not participate in
4626 // overload resolution if it would lead to ambiguity with the move
4627 // constructor that does not take an allocator (below) or with the
4628 // constructor taking a 'valueOrAllocator' (above).
4629
4630 template <class TYPE>
4631#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4632 Variant15(TYPE&& value,
4633 typename bsl::enable_if<
4634 !bsl::is_same<
4635 SelfType,
4636 typename bsl::remove_const<
4637 typename bsl::remove_reference<TYPE>::type>::type>::value,
4638 bslma::Allocator>::type *basicAllocator);
4639#else
4640 Variant15(bslmf::MovableRef<TYPE> value,
4641 bslma::Allocator *basicAllocator);
4642#endif
4643 // Create a variant object having the specified 'value' of template
4644 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
4645 // memory. If 'basicAllocator' is 0, the currently installed default
4646 // allocator is used. The contents of 'value' are moved to the
4647 // newly-created object with 'value' left in a valid but unspecified
4648 // state. 'TYPE' must be the same as one of the types that this
4649 // variant can hold. Note that in C++11 mode, this method does not
4650 // participate in overload resolution if it would lead to ambiguity
4651 // with the move constructor that takes an allocator (below).
4652
4653 /// Create a variant object having the type and value of the specified
4654 /// `original` variant. Optionally specify a `basicAllocator` used to
4655 /// supply memory. If `basicAllocator` is 0, the currently installed
4656 /// default allocator is used.
4657 Variant15(const Variant15& original, bslma::Allocator *basicAllocator = 0);
4658
4659 /// Create a variant object having the type and value of the specified
4660 /// `original` object by moving the contents of `original` to the
4661 /// newly-created object. The allocator associated with `original` (if
4662 /// any) is propagated for use in the newly-created object. `original`
4663 /// is left in a valid but unspecified state.
4664 Variant15(bslmf::MovableRef<Variant15> original);
4665
4666 /// Create a variant object having the type and value of the specified
4667 /// `original` object that uses the specified `basicAllocator` to supply
4668 /// memory. If `basicAllocator` is 0, the currently installed default
4669 /// allocator is used. The contents of `original` are moved to the
4670 /// newly-created object with `original` left in a valid but unspecified
4671 /// state.
4672 Variant15(bslmf::MovableRef<Variant15> original,
4673 bslma::Allocator *basicAllocator);
4674
4675 // MANIPULATORS
4676
4677 /// Assign to this object the specified `value` of template parameter
4678 /// `TYPE`, and return a reference providing modifiable access to this
4679 /// object. The value currently held by this variant (if any) is
4680 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
4681 /// must be the same as one of the types that this variant can hold.
4682 template <class TYPE>
4683 Variant15& operator=(const TYPE& value);
4684
4685 template <class TYPE>
4686#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4687 typename bsl::enable_if<
4688 !bsl::is_same<SelfType,
4689 typename bsl::remove_cvref<TYPE>::type>::value,
4690 SelfType>::type&
4691 operator=(TYPE&& value);
4692#else
4693 Variant15&
4694 operator=(bslmf::MovableRef<TYPE> value);
4695#endif
4696 // Assign to this object the specified 'value' of template parameter
4697 // 'TYPE', and return a reference providing modifiable access to this
4698 // object. The contents of 'value' are moved to this object with
4699 // 'value' left in a valid but unspecified state. The value currently
4700 // held by this variant (if any) is destroyed if that value's type is
4701 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
4702 // that this variant can hold. Note that in C++11 mode, this method
4703 // does not participate in overload resolution if it would lead to
4704 // ambiguity with the move-assignment operator (below).
4705
4706 /// Assign to this object the type and value currently held by the
4707 /// specified `rhs` object, and return a reference providing modifiable
4708 /// access to this object. The value currently held by this variant
4709 /// (if any) is destroyed if that value's type is not the same as the
4710 /// type held by the `rhs` object.
4711 Variant15& operator=(const Variant15& rhs);
4712
4713 /// Assign to this object the type and value currently held by the
4714 /// specified `rhs` object, and return a reference providing modifiable
4715 /// access to this object. The value currently held by this variant
4716 /// (if any) is destroyed if that value's type is not the same as the
4717 /// type held by the `rhs` object. The contents of `rhs` are either
4718 /// move-inserted into or move-assigned to this object with `rhs` left
4719 /// in a valid but unspecified state.
4720 Variant15& operator=(bslmf::MovableRef<Variant15> rhs);
4721};
4722
4723 // ====================
4724 // class Variant16<...>
4725 // ====================
4726
4727/// This class is a "specialization" of `Variant` for a fixed number (16) of
4728/// types. Its 16 template arguments *must* all be specified (none are
4729/// defaulted to `bslmf::Nil`). It provides the same functionality as
4730/// `Variant<A1, A2, ..., A16>`.
4731template <class A1, class A2, class A3, class A4, class A5, class A6,
4732 class A7, class A8, class A9, class A10, class A11, class A12,
4733 class A13, class A14, class A15, class A16>
4734class Variant16 : public VariantImp<typename bslmf::TypeList16<
4735 A1, A2, A3, A4, A5,
4736 A6, A7, A8, A9, A10,
4737 A11, A12, A13, A14, A15,
4738 A16>::ListType> {
4739
4740 // PRIVATE TYPES
4741 typedef VariantImp<typename bslmf::TypeList16<A1, A2, A3, A4, A5, A6,
4742 A7, A8, A9, A10, A11, A12,
4743 A13, A14, A15,
4744 A16>::ListType> Imp;
4745
4746 /// `SelfType` is an alias to this class.
4747 typedef Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9,
4748 A10, A11, A12, A13, A14, A15, A16> SelfType;
4749
4750 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
4751 typedef bslmf::MovableRefUtil MoveUtil;
4752
4753 public:
4754 // TRAITS
4757 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
4760 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
4763 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
4764 BSLMF_NESTED_TRAIT_DECLARATION(Variant16, HasPrintMethod);
4765
4766 // CREATORS
4767
4768 /// Create a variant object in the unset state that uses the currently
4769 /// installed default allocator to supply memory.
4770 Variant16();
4771
4772 /// Create a variant object with the specified `valueOrAllocator` that
4773 /// can be either a value of a type that the variant can hold or an
4774 /// allocator to supply memory. If `valueOrAllocator` is not a
4775 /// `bslma::Allocator *`, then the variant will hold the value and type
4776 /// of `valueOrAllocator`, and use the currently installed default
4777 /// allocator to supply memory. Otherwise, the variant will be unset
4778 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
4779 /// must be the same as one of the types that this variant can hold or
4780 /// be convertible to `bslma::Allocator *`. Note that this
4781 /// parameterized constructor is defined instead of two constructors
4782 /// (one taking a `bslma::Allocator *` and the other not) because
4783 /// template parameter arguments are always a better match than
4784 /// derived-to-base conversion (a concrete allocator pointer converted
4785 /// to `bslma::Allocator *`).
4786 template <class TYPE_OR_ALLOCATOR>
4787 explicit
4788 Variant16(const TYPE_OR_ALLOCATOR& valueOrAllocator);
4789
4790 /// Create a variant object having the specified `value` of template
4791 /// parameter `TYPE` and that uses the specified `basicAllocator` to
4792 /// supply memory. If `basicAllocator` is 0, the currently installed
4793 /// default allocator is used. `TYPE` must be the same as one of the
4794 /// types that this variant can hold.
4795 template <class TYPE>
4796 Variant16(const TYPE& value, bslma::Allocator *basicAllocator);
4797
4798 template <class TYPE>
4799 explicit
4800#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4801 Variant16(TYPE&& value,
4802 typename bsl::enable_if<
4803 !bsl::is_same<
4804 SelfType,
4805 typename bsl::remove_const<
4806 typename bsl::remove_reference<TYPE>::type>::type>::value
4807 &&
4809 void>::type * = 0);
4810#else
4811 Variant16(bslmf::MovableRef<TYPE> value);
4812#endif
4813 // Create a variant object having the specified 'value' of template
4814 // parameter 'TYPE' by moving the contents of 'value' to the
4815 // newly-created object. Use the currently installed default allocator
4816 // to supply memory. 'value' is left in a valid but unspecified state.
4817 // 'TYPE' must be the same as one of the types that this variant can
4818 // hold. Note that in C++11 mode, this method does not participate in
4819 // overload resolution if it would lead to ambiguity with the move
4820 // constructor that does not take an allocator (below) or with the
4821 // constructor taking a 'valueOrAllocator' (above).
4822
4823 template <class TYPE>
4824#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4825 Variant16(TYPE&& value,
4826 typename bsl::enable_if<
4827 !bsl::is_same<
4828 SelfType,
4829 typename bsl::remove_const<
4830 typename bsl::remove_reference<TYPE>::type>::type>::value,
4831 bslma::Allocator>::type *basicAllocator);
4832#else
4833 Variant16(bslmf::MovableRef<TYPE> value,
4834 bslma::Allocator *basicAllocator);
4835#endif
4836 // Create a variant object having the specified 'value' of template
4837 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
4838 // memory. If 'basicAllocator' is 0, the currently installed default
4839 // allocator is used. The contents of 'value' are moved to the
4840 // newly-created object with 'value' left in a valid but unspecified
4841 // state. 'TYPE' must be the same as one of the types that this
4842 // variant can hold. Note that in C++11 mode, this method does not
4843 // participate in overload resolution if it would lead to ambiguity
4844 // with the move constructor that takes an allocator (below).
4845
4846 /// Create a variant object having the type and value of the specified
4847 /// `original` variant. Optionally specify a `basicAllocator` used to
4848 /// supply memory. If `basicAllocator` is 0, the currently installed
4849 /// default allocator is used.
4850 Variant16(const Variant16& original, bslma::Allocator *basicAllocator = 0);
4851
4852 /// Create a variant object having the type and value of the specified
4853 /// `original` object by moving the contents of `original` to the
4854 /// newly-created object. The allocator associated with `original` (if
4855 /// any) is propagated for use in the newly-created object. `original`
4856 /// is left in a valid but unspecified state.
4857 Variant16(bslmf::MovableRef<Variant16> original);
4858
4859 /// Create a variant object having the type and value of the specified
4860 /// `original` object that uses the specified `basicAllocator` to supply
4861 /// memory. If `basicAllocator` is 0, the currently installed default
4862 /// allocator is used. The contents of `original` are moved to the
4863 /// newly-created object with `original` left in a valid but unspecified
4864 /// state.
4865 Variant16(bslmf::MovableRef<Variant16> original,
4866 bslma::Allocator *basicAllocator);
4867
4868 // MANIPULATORS
4869
4870 /// Assign to this object the specified `value` of template parameter
4871 /// `TYPE`, and return a reference providing modifiable access to this
4872 /// object. The value currently held by this variant (if any) is
4873 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
4874 /// must be the same as one of the types that this variant can hold.
4875 template <class TYPE>
4876 Variant16& operator=(const TYPE& value);
4877
4878 template <class TYPE>
4879#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4880 typename bsl::enable_if<
4881 !bsl::is_same<SelfType,
4882 typename bsl::remove_cvref<TYPE>::type>::value,
4883 SelfType>::type&
4884 operator=(TYPE&& value);
4885#else
4886 Variant16&
4887 operator=(bslmf::MovableRef<TYPE> value);
4888#endif
4889 // Assign to this object the specified 'value' of template parameter
4890 // 'TYPE', and return a reference providing modifiable access to this
4891 // object. The contents of 'value' are moved to this object with
4892 // 'value' left in a valid but unspecified state. The value currently
4893 // held by this variant (if any) is destroyed if that value's type is
4894 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
4895 // that this variant can hold. Note that in C++11 mode, this method
4896 // does not participate in overload resolution if it would lead to
4897 // ambiguity with the move-assignment operator (below).
4898
4899 /// Assign to this object the type and value currently held by the
4900 /// specified `rhs` object, and return a reference providing modifiable
4901 /// access to this object. The value currently held by this variant
4902 /// (if any) is destroyed if that value's type is not the same as the
4903 /// type held by the `rhs` object.
4904 Variant16& operator=(const Variant16& rhs);
4905
4906 /// Assign to this object the type and value currently held by the
4907 /// specified `rhs` object, and return a reference providing modifiable
4908 /// access to this object. The value currently held by this variant
4909 /// (if any) is destroyed if that value's type is not the same as the
4910 /// type held by the `rhs` object. The contents of `rhs` are either
4911 /// move-inserted into or move-assigned to this object with `rhs` left
4912 /// in a valid but unspecified state.
4913 Variant16& operator=(bslmf::MovableRef<Variant16> rhs);
4914};
4915
4916 // ====================
4917 // class Variant17<...>
4918 // ====================
4919
4920/// This class is a "specialization" of `Variant` for a fixed number (17) of
4921/// types. Its 17 template arguments *must* all be specified (none are
4922/// defaulted to `bslmf::Nil`). It provides the same functionality as
4923/// `Variant<A1, A2, ..., A17>`.
4924template <class A1, class A2, class A3, class A4, class A5, class A6,
4925 class A7, class A8, class A9, class A10, class A11, class A12,
4926 class A13, class A14, class A15, class A16, class A17>
4927class Variant17 : public VariantImp<typename bslmf::TypeList17<
4928 A1, A2, A3, A4, A5,
4929 A6, A7, A8, A9, A10,
4930 A11, A12, A13, A14, A15,
4931 A16, A17>::ListType> {
4932
4933 // PRIVATE TYPES
4934 typedef VariantImp<typename bslmf::TypeList17<A1, A2, A3, A4, A5, A6,
4935 A7, A8, A9, A10, A11, A12,
4936 A13, A14, A15, A16,
4937 A17>::ListType> Imp;
4938
4939 /// `SelfType` is an alias to this class.
4940 typedef Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9,
4941 A10, A11, A12, A13, A14, A15, A16, A17> SelfType;
4942
4943 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
4944 typedef bslmf::MovableRefUtil MoveUtil;
4945
4946 public:
4947 // TRAITS
4950 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
4953 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
4956 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
4957 BSLMF_NESTED_TRAIT_DECLARATION(Variant17, HasPrintMethod);
4958
4959 // CREATORS
4960
4961 /// Create a variant object in the unset state that uses the currently
4962 /// installed default allocator to supply memory.
4963 Variant17();
4964
4965 /// Create a variant object with the specified `valueOrAllocator` that
4966 /// can be either a value of a type that the variant can hold or an
4967 /// allocator to supply memory. If `valueOrAllocator` is not a
4968 /// `bslma::Allocator *`, then the variant will hold the value and type
4969 /// of `valueOrAllocator`, and use the currently installed default
4970 /// allocator to supply memory. Otherwise, the variant will be unset
4971 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
4972 /// must be the same as one of the types that this variant can hold or
4973 /// be convertible to `bslma::Allocator *`. Note that this
4974 /// parameterized constructor is defined instead of two constructors
4975 /// (one taking a `bslma::Allocator *` and the other not) because
4976 /// template parameter arguments are always a better match than
4977 /// derived-to-base conversion (a concrete allocator pointer converted
4978 /// to `bslma::Allocator *`).
4979 template <class TYPE_OR_ALLOCATOR>
4980 explicit
4981 Variant17(const TYPE_OR_ALLOCATOR& valueOrAllocator);
4982
4983 /// Create a variant object having the specified `value` of template
4984 /// parameter `TYPE` and that uses the specified `basicAllocator` to
4985 /// supply memory. If `basicAllocator` is 0, the currently installed
4986 /// default allocator is used. `TYPE` must be the same as one of the
4987 /// types that this variant can hold.
4988 template <class TYPE>
4989 Variant17(const TYPE& value, bslma::Allocator *basicAllocator);
4990
4991 template <class TYPE>
4992 explicit
4993#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
4994 Variant17(TYPE&& value,
4995 typename bsl::enable_if<
4996 !bsl::is_same<
4997 SelfType,
4998 typename bsl::remove_const<
4999 typename bsl::remove_reference<TYPE>::type>::type>::value
5000 &&
5002 void>::type * = 0);
5003#else
5004 Variant17(bslmf::MovableRef<TYPE> value);
5005#endif
5006 // Create a variant object having the specified 'value' of template
5007 // parameter 'TYPE' by moving the contents of 'value' to the
5008 // newly-created object. Use the currently installed default allocator
5009 // to supply memory. 'value' is left in a valid but unspecified state.
5010 // 'TYPE' must be the same as one of the types that this variant can
5011 // hold. Note that in C++11 mode, this method does not participate in
5012 // overload resolution if it would lead to ambiguity with the move
5013 // constructor that does not take an allocator (below) or with the
5014 // constructor taking a 'valueOrAllocator' (above).
5015
5016 template <class TYPE>
5017#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5018 Variant17(TYPE&& value,
5019 typename bsl::enable_if<
5020 !bsl::is_same<
5021 SelfType,
5022 typename bsl::remove_const<
5023 typename bsl::remove_reference<TYPE>::type>::type>::value,
5024 bslma::Allocator>::type *basicAllocator);
5025#else
5026 Variant17(bslmf::MovableRef<TYPE> value,
5027 bslma::Allocator *basicAllocator);
5028#endif
5029 // Create a variant object having the specified 'value' of template
5030 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
5031 // memory. If 'basicAllocator' is 0, the currently installed default
5032 // allocator is used. The contents of 'value' are moved to the
5033 // newly-created object with 'value' left in a valid but unspecified
5034 // state. 'TYPE' must be the same as one of the types that this
5035 // variant can hold. Note that in C++11 mode, this method does not
5036 // participate in overload resolution if it would lead to ambiguity
5037 // with the move constructor that takes an allocator (below).
5038
5039 /// Create a variant object having the type and value of the specified
5040 /// `original` variant. Optionally specify a `basicAllocator` used to
5041 /// supply memory. If `basicAllocator` is 0, the currently installed
5042 /// default allocator is used.
5043 Variant17(const Variant17& original, bslma::Allocator *basicAllocator = 0);
5044
5045 /// Create a variant object having the type and value of the specified
5046 /// `original` object by moving the contents of `original` to the
5047 /// newly-created object. The allocator associated with `original` (if
5048 /// any) is propagated for use in the newly-created object. `original`
5049 /// is left in a valid but unspecified state.
5050 Variant17(bslmf::MovableRef<Variant17> original);
5051
5052 /// Create a variant object having the type and value of the specified
5053 /// `original` object that uses the specified `basicAllocator` to supply
5054 /// memory. If `basicAllocator` is 0, the currently installed default
5055 /// allocator is used. The contents of `original` are moved to the
5056 /// newly-created object with `original` left in a valid but unspecified
5057 /// state.
5058 Variant17(bslmf::MovableRef<Variant17> original,
5059 bslma::Allocator *basicAllocator);
5060
5061 // MANIPULATORS
5062
5063 /// Assign to this object the specified `value` of template parameter
5064 /// `TYPE`, and return a reference providing modifiable access to this
5065 /// object. The value currently held by this variant (if any) is
5066 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
5067 /// must be the same as one of the types that this variant can hold.
5068 template <class TYPE>
5069 Variant17& operator=(const TYPE& value);
5070
5071 template <class TYPE>
5072#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5073 typename bsl::enable_if<
5074 !bsl::is_same<SelfType,
5075 typename bsl::remove_cvref<TYPE>::type>::value,
5076 SelfType>::type&
5077 operator=(TYPE&& value);
5078#else
5079 Variant17&
5080 operator=(bslmf::MovableRef<TYPE> value);
5081#endif
5082 // Assign to this object the specified 'value' of template parameter
5083 // 'TYPE', and return a reference providing modifiable access to this
5084 // object. The contents of 'value' are moved to this object with
5085 // 'value' left in a valid but unspecified state. The value currently
5086 // held by this variant (if any) is destroyed if that value's type is
5087 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
5088 // that this variant can hold. Note that in C++11 mode, this method
5089 // does not participate in overload resolution if it would lead to
5090 // ambiguity with the move-assignment operator (below).
5091
5092 /// Assign to this object the type and value currently held by the
5093 /// specified `rhs` object, and return a reference providing modifiable
5094 /// access to this object. The value currently held by this variant
5095 /// (if any) is destroyed if that value's type is not the same as the
5096 /// type held by the `rhs` object.
5097 Variant17& operator=(const Variant17& rhs);
5098
5099 /// Assign to this object the type and value currently held by the
5100 /// specified `rhs` object, and return a reference providing modifiable
5101 /// access to this object. The value currently held by this variant
5102 /// (if any) is destroyed if that value's type is not the same as the
5103 /// type held by the `rhs` object. The contents of `rhs` are either
5104 /// move-inserted into or move-assigned to this object with `rhs` left
5105 /// in a valid but unspecified state.
5106 Variant17& operator=(bslmf::MovableRef<Variant17> rhs);
5107};
5108
5109 // ====================
5110 // class Variant18<...>
5111 // ====================
5112
5113/// This class is a "specialization" of `Variant` for a fixed number (18) of
5114/// types. Its 18 template arguments *must* all be specified (none are
5115/// defaulted to `bslmf::Nil`). It provides the same functionality as
5116/// `Variant<A1, A2, ..., A18>`.
5117template <class A1, class A2, class A3, class A4, class A5, class A6,
5118 class A7, class A8, class A9, class A10, class A11, class A12,
5119 class A13, class A14, class A15, class A16, class A17, class A18>
5120class Variant18 : public VariantImp<typename bslmf::TypeList18<
5121 A1, A2, A3, A4, A5,
5122 A6, A7, A8, A9, A10,
5123 A11, A12, A13, A14, A15,
5124 A16, A17, A18>::ListType> {
5125
5126 // PRIVATE TYPES
5127 typedef VariantImp<typename bslmf::TypeList18<A1, A2, A3, A4, A5, A6,
5128 A7, A8, A9, A10, A11, A12,
5129 A13, A14, A15, A16, A17,
5130 A18>::ListType> Imp;
5131
5132 /// `SelfType` is an alias to this class.
5133 typedef Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9,
5134 A10, A11, A12, A13, A14, A15, A16, A17, A18> SelfType;
5135
5136 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
5137 typedef bslmf::MovableRefUtil MoveUtil;
5138
5139 public:
5140 // TRAITS
5143 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
5146 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
5149 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
5150 BSLMF_NESTED_TRAIT_DECLARATION(Variant18, HasPrintMethod);
5151
5152 // CREATORS
5153
5154 /// Create a variant object in the unset state that uses the currently
5155 /// installed default allocator to supply memory.
5156 Variant18();
5157
5158 /// Create a variant object with the specified `valueOrAllocator` that
5159 /// can be either a value of a type that the variant can hold or an
5160 /// allocator to supply memory. If `valueOrAllocator` is not a
5161 /// `bslma::Allocator *`, then the variant will hold the value and type
5162 /// of `valueOrAllocator`, and use the currently installed default
5163 /// allocator to supply memory. Otherwise, the variant will be unset
5164 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
5165 /// must be the same as one of the types that this variant can hold or
5166 /// be convertible to `bslma::Allocator *`. Note that this
5167 /// parameterized constructor is defined instead of two constructors
5168 /// (one taking a `bslma::Allocator *` and the other not) because
5169 /// template parameter arguments are always a better match than
5170 /// derived-to-base conversion (a concrete allocator pointer converted
5171 /// to `bslma::Allocator *`).
5172 template <class TYPE_OR_ALLOCATOR>
5173 explicit
5174 Variant18(const TYPE_OR_ALLOCATOR& valueOrAllocator);
5175
5176 /// Create a variant object having the specified `value` of template
5177 /// parameter `TYPE` and that uses the specified `basicAllocator` to
5178 /// supply memory. If `basicAllocator` is 0, the currently installed
5179 /// default allocator is used. `TYPE` must be the same as one of the
5180 /// types that this variant can hold.
5181 template <class TYPE>
5182 Variant18(const TYPE& value, bslma::Allocator *basicAllocator);
5183
5184 template <class TYPE>
5185 explicit
5186#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5187 Variant18(TYPE&& value,
5188 typename bsl::enable_if<
5189 !bsl::is_same<
5190 SelfType,
5191 typename bsl::remove_const<
5192 typename bsl::remove_reference<TYPE>::type>::type>::value
5193 &&
5195 void>::type * = 0);
5196#else
5197 Variant18(bslmf::MovableRef<TYPE> value);
5198#endif
5199 // Create a variant object having the specified 'value' of template
5200 // parameter 'TYPE' by moving the contents of 'value' to the
5201 // newly-created object. Use the currently installed default allocator
5202 // to supply memory. 'value' is left in a valid but unspecified state.
5203 // 'TYPE' must be the same as one of the types that this variant can
5204 // hold. Note that in C++11 mode, this method does not participate in
5205 // overload resolution if it would lead to ambiguity with the move
5206 // constructor that does not take an allocator (below) or with the
5207 // constructor taking a 'valueOrAllocator' (above).
5208
5209 template <class TYPE>
5210#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5211 Variant18(TYPE&& value,
5212 typename bsl::enable_if<
5213 !bsl::is_same<
5214 SelfType,
5215 typename bsl::remove_const<
5216 typename bsl::remove_reference<TYPE>::type>::type>::value,
5217 bslma::Allocator>::type *basicAllocator);
5218#else
5219 Variant18(bslmf::MovableRef<TYPE> value,
5220 bslma::Allocator *basicAllocator);
5221#endif
5222 // Create a variant object having the specified 'value' of template
5223 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
5224 // memory. If 'basicAllocator' is 0, the currently installed default
5225 // allocator is used. The contents of 'value' are moved to the
5226 // newly-created object with 'value' left in a valid but unspecified
5227 // state. 'TYPE' must be the same as one of the types that this
5228 // variant can hold. Note that in C++11 mode, this method does not
5229 // participate in overload resolution if it would lead to ambiguity
5230 // with the move constructor that takes an allocator (below).
5231
5232 /// Create a variant object having the type and value of the specified
5233 /// `original` variant. Optionally specify a `basicAllocator` used to
5234 /// supply memory. If `basicAllocator` is 0, the currently installed
5235 /// default allocator is used.
5236 Variant18(const Variant18& original, bslma::Allocator *basicAllocator = 0);
5237
5238 /// Create a variant object having the type and value of the specified
5239 /// `original` object by moving the contents of `original` to the
5240 /// newly-created object. The allocator associated with `original` (if
5241 /// any) is propagated for use in the newly-created object. `original`
5242 /// is left in a valid but unspecified state.
5243 Variant18(bslmf::MovableRef<Variant18> original);
5244
5245 /// Create a variant object having the type and value of the specified
5246 /// `original` object that uses the specified `basicAllocator` to supply
5247 /// memory. If `basicAllocator` is 0, the currently installed default
5248 /// allocator is used. The contents of `original` are moved to the
5249 /// newly-created object with `original` left in a valid but unspecified
5250 /// state.
5251 Variant18(bslmf::MovableRef<Variant18> original,
5252 bslma::Allocator *basicAllocator);
5253
5254 // MANIPULATORS
5255
5256 /// Assign to this object the specified `value` of template parameter
5257 /// `TYPE`, and return a reference providing modifiable access to this
5258 /// object. The value currently held by this variant (if any) is
5259 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
5260 /// must be the same as one of the types that this variant can hold.
5261 template <class TYPE>
5262 Variant18& operator=(const TYPE& value);
5263
5264 template <class TYPE>
5265#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5266 typename bsl::enable_if<
5267 !bsl::is_same<SelfType,
5268 typename bsl::remove_cvref<TYPE>::type>::value,
5269 SelfType>::type&
5270 operator=(TYPE&& value);
5271#else
5272 Variant18&
5273 operator=(bslmf::MovableRef<TYPE> value);
5274#endif
5275 // Assign to this object the specified 'value' of template parameter
5276 // 'TYPE', and return a reference providing modifiable access to this
5277 // object. The contents of 'value' are moved to this object with
5278 // 'value' left in a valid but unspecified state. The value currently
5279 // held by this variant (if any) is destroyed if that value's type is
5280 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
5281 // that this variant can hold. Note that in C++11 mode, this method
5282 // does not participate in overload resolution if it would lead to
5283 // ambiguity with the move-assignment operator (below).
5284
5285 /// Assign to this object the type and value currently held by the
5286 /// specified `rhs` object, and return a reference providing modifiable
5287 /// access to this object. The value currently held by this variant
5288 /// (if any) is destroyed if that value's type is not the same as the
5289 /// type held by the `rhs` object.
5290 Variant18& operator=(const Variant18& rhs);
5291
5292 /// Assign to this object the type and value currently held by the
5293 /// specified `rhs` object, and return a reference providing modifiable
5294 /// access to this object. The value currently held by this variant
5295 /// (if any) is destroyed if that value's type is not the same as the
5296 /// type held by the `rhs` object. The contents of `rhs` are either
5297 /// move-inserted into or move-assigned to this object with `rhs` left
5298 /// in a valid but unspecified state.
5299 Variant18& operator=(bslmf::MovableRef<Variant18> rhs);
5300};
5301
5302 // ====================
5303 // class Variant19<...>
5304 // ====================
5305
5306/// This class is a "specialization" of `Variant` for a fixed number (19) of
5307/// types. Its 19 template arguments *must* all be specified (none are
5308/// defaulted to `bslmf::Nil`). It provides the same functionality as
5309/// `Variant<A1, A2, ..., A19>`.
5310template <class A1, class A2, class A3, class A4, class A5, class A6,
5311 class A7, class A8, class A9, class A10, class A11, class A12,
5312 class A13, class A14, class A15, class A16, class A17, class A18,
5313 class A19>
5314class Variant19 : public VariantImp<typename bslmf::TypeList19<
5315 A1, A2, A3, A4, A5,
5316 A6, A7, A8, A9, A10,
5317 A11, A12, A13, A14, A15,
5318 A16, A17, A18, A19>::ListType> {
5319
5320 // PRIVATE TYPES
5321 typedef VariantImp<typename bslmf::TypeList19<A1, A2, A3, A4, A5, A6,
5322 A7, A8, A9, A10, A11, A12,
5323 A13, A14, A15, A16, A17, A18,
5324 A19>::ListType> Imp;
5325
5326 /// `SelfType` is an alias to this class.
5327 typedef Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9,
5328 A10, A11, A12, A13, A14, A15, A16, A17, A18,
5329 A19> SelfType;
5330
5331 typedef VariantImp_Traits<typename Imp::TypeList> Traits;
5332 typedef bslmf::MovableRefUtil MoveUtil;
5333
5334 public:
5335 // TRAITS
5338 Traits::k_VARIANT_USES_BSLMA_ALLOCATOR);
5341 Traits::k_VARIANT_IS_BITWISE_COPYABLE);
5344 Traits::k_VARIANT_IS_BITWISE_MOVEABLE);
5345 BSLMF_NESTED_TRAIT_DECLARATION(Variant19, HasPrintMethod);
5346
5347 // CREATORS
5348
5349 /// Create a variant object in the unset state that uses the currently
5350 /// installed default allocator to supply memory.
5351 Variant19();
5352
5353 /// Create a variant object with the specified `valueOrAllocator` that
5354 /// can be either a value of a type that the variant can hold or an
5355 /// allocator to supply memory. If `valueOrAllocator` is not a
5356 /// `bslma::Allocator *`, then the variant will hold the value and type
5357 /// of `valueOrAllocator`, and use the currently installed default
5358 /// allocator to supply memory. Otherwise, the variant will be unset
5359 /// and use `valueOrAllocator` to supply memory. `TYPE_OR_ALLOCATOR`
5360 /// must be the same as one of the types that this variant can hold or
5361 /// be convertible to `bslma::Allocator *`. Note that this
5362 /// parameterized constructor is defined instead of two constructors
5363 /// (one taking a `bslma::Allocator *` and the other not) because
5364 /// template parameter arguments are always a better match than
5365 /// derived-to-base conversion (a concrete allocator pointer converted
5366 /// to `bslma::Allocator *`).
5367 template <class TYPE_OR_ALLOCATOR>
5368 explicit
5369 Variant19(const TYPE_OR_ALLOCATOR& valueOrAllocator);
5370
5371 /// Create a variant object having the specified `value` of template
5372 /// parameter `TYPE` and that uses the specified `basicAllocator` to
5373 /// supply memory. If `basicAllocator` is 0, the currently installed
5374 /// default allocator is used. `TYPE` must be the same as one of the
5375 /// types that this variant can hold.
5376 template <class TYPE>
5377 Variant19(const TYPE& value, bslma::Allocator *basicAllocator);
5378
5379 template <class TYPE>
5380 explicit
5381#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5382 Variant19(TYPE&& value,
5383 typename bsl::enable_if<
5384 !bsl::is_same<
5385 SelfType,
5386 typename bsl::remove_const<
5387 typename bsl::remove_reference<TYPE>::type>::type>::value
5388 &&
5390 void>::type * = 0);
5391#else
5392 Variant19(bslmf::MovableRef<TYPE> value);
5393#endif
5394 // Create a variant object having the specified 'value' of template
5395 // parameter 'TYPE' by moving the contents of 'value' to the
5396 // newly-created object. Use the currently installed default allocator
5397 // to supply memory. 'value' is left in a valid but unspecified state.
5398 // 'TYPE' must be the same as one of the types that this variant can
5399 // hold. Note that in C++11 mode, this method does not participate in
5400 // overload resolution if it would lead to ambiguity with the move
5401 // constructor that does not take an allocator (below) or with the
5402 // constructor taking a 'valueOrAllocator' (above).
5403
5404 template <class TYPE>
5405#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5406 Variant19(TYPE&& value,
5407 typename bsl::enable_if<
5408 !bsl::is_same<
5409 SelfType,
5410 typename bsl::remove_const<
5411 typename bsl::remove_reference<TYPE>::type>::type>::value,
5412 bslma::Allocator>::type *basicAllocator);
5413#else
5414 Variant19(bslmf::MovableRef<TYPE> value,
5415 bslma::Allocator *basicAllocator);
5416#endif
5417 // Create a variant object having the specified 'value' of template
5418 // parameter 'TYPE' that uses the specified 'basicAllocator' to supply
5419 // memory. If 'basicAllocator' is 0, the currently installed default
5420 // allocator is used. The contents of 'value' are moved to the
5421 // newly-created object with 'value' left in a valid but unspecified
5422 // state. 'TYPE' must be the same as one of the types that this
5423 // variant can hold. Note that in C++11 mode, this method does not
5424 // participate in overload resolution if it would lead to ambiguity
5425 // with the move constructor that takes an allocator (below).
5426
5427 /// Create a variant object having the type and value of the specified
5428 /// `original` variant. Optionally specify a `basicAllocator` used to
5429 /// supply memory. If `basicAllocator` is 0, the currently installed
5430 /// default allocator is used.
5431 Variant19(const Variant19& original, bslma::Allocator *basicAllocator = 0);
5432
5433 /// Create a variant object having the type and value of the specified
5434 /// `original` object by moving the contents of `original` to the
5435 /// newly-created object. The allocator associated with `original` (if
5436 /// any) is propagated for use in the newly-created object. `original`
5437 /// is left in a valid but unspecified state.
5438 Variant19(bslmf::MovableRef<Variant19> original);
5439
5440 /// Create a variant object having the type and value of the specified
5441 /// `original` object that uses the specified `basicAllocator` to supply
5442 /// memory. If `basicAllocator` is 0, the currently installed default
5443 /// allocator is used. The contents of `original` are moved to the
5444 /// newly-created object with `original` left in a valid but unspecified
5445 /// state.
5446 Variant19(bslmf::MovableRef<Variant19> original,
5447 bslma::Allocator *basicAllocator);
5448
5449 // MANIPULATORS
5450
5451 /// Assign to this object the specified `value` of template parameter
5452 /// `TYPE`, and return a reference providing modifiable access to this
5453 /// object. The value currently held by this variant (if any) is
5454 /// destroyed if that value's type is not the same as `TYPE`. `TYPE`
5455 /// must be the same as one of the types that this variant can hold.
5456 template <class TYPE>
5457 Variant19& operator=(const TYPE& value);
5458
5459 template <class TYPE>
5460#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
5461 typename bsl::enable_if<
5462 !bsl::is_same<SelfType,
5463 typename bsl::remove_cvref<TYPE>::type>::value,
5464 SelfType>::type&
5465 operator=(TYPE&& value);
5466#else
5467 Variant19&
5468 operator=(bslmf::MovableRef<TYPE> value);
5469#endif
5470 // Assign to this object the specified 'value' of template parameter
5471 // 'TYPE', and return a reference providing modifiable access to this
5472 // object. The contents of 'value' are moved to this object with
5473 // 'value' left in a valid but unspecified state. The value currently
5474 // held by this variant (if any) is destroyed if that value's type is
5475 // not the same as 'TYPE'. 'TYPE' must be the same as one of the types
5476 // that this variant can hold. Note that in C++11 mode, this method
5477 // does not participate in overload resolution if it would lead to
5478 // ambiguity with the move-assignment operator (below).
5479
5480 /// Assign to this object the type and value currently held by the
5481 /// specified `rhs` object, and return a reference providing modifiable
5482 /// access to this object. The value currently held by this variant
5483 /// (if any) is destroyed if that value's type is not the same as the
5484 /// type held by the `rhs` object.
5485 Variant19& operator=(const Variant19& rhs);
5486
5487 /// Assign to this object the type and value currently held by the
5488 /// specified `rhs` object, and return a reference providing modifiable
5489 /// access to this object. The value currently held by this variant
5490 /// (if any) is destroyed if that value's type is not the same as the
5491 /// type held by the `rhs` object. The contents of `rhs` are either
5492 /// move-inserted into or move-assigned to this object with `rhs` left
5493 /// in a valid but unspecified state.
5494 Variant19& operator=(bslmf::MovableRef<Variant19> rhs);
5495};
5496
5497// ---- Anything below this line is implementation specific. Do not use. ----
5498
5499 // =====================================
5500 // struct Variant_TypeIndex<TYPES, TYPE>
5501 // =====================================
5502
5503/// Component-private meta-function. Do not use. This meta-function
5504/// computes the index of the template parameter `TYPE` in the template
5505/// parameter list of `TYPES`.
5506template <class TYPES, class TYPE>
5507struct Variant_TypeIndex {
5508
5509 enum {
5510 value = bsl::is_same<
5512 TYPE>::value ? 1
5513 : bsl::is_same<
5515 TYPE>::value ? 2
5516 : bsl::is_same<
5518 TYPE>::value ? 3
5519 : bsl::is_same<
5521 TYPE>::value ? 4
5522 : bsl::is_same<
5524 TYPE>::value ? 5
5525 : bsl::is_same<
5527 TYPE>::value ? 6
5528 : bsl::is_same<
5530 TYPE>::value ? 7
5531 : bsl::is_same<
5533 TYPE>::value ? 8
5534 : bsl::is_same<
5536 TYPE>::value ? 9
5537 : bsl::is_same<
5539 TYPE>::value ? 10
5540 : bsl::is_same<
5542 TYPE>::value ? 11
5543 : bsl::is_same<
5545 TYPE>::value ? 12
5546 : bsl::is_same<
5548 TYPE>::value ? 13
5549 : bsl::is_same<
5551 TYPE>::value ? 14
5552 : bsl::is_same<
5554 TYPE>::value ? 15
5555 : bsl::is_same<
5557 TYPE>::value ? 16
5558 : bsl::is_same<
5560 TYPE>::value ? 17
5561 : bsl::is_same<
5563 TYPE>::value ? 18
5564 : bsl::is_same<
5566 TYPE>::value ? 19
5567 : bsl::is_same<
5569 TYPE>::value ? 20
5571 ? 21
5572 : 0
5573 };
5574
5575 BSLMF_ASSERT(0 != value);
5576
5577#if defined(BDLB_VARIANT_USING_VARIADIC_TEMPLATES)
5578 // See 'testCase17' in the test driver for code snippets that motivate this
5579 // compile-time assertion (see the "out of bounds" comments). In C++03,
5580 // 'TYPES::LENGTH' yields an incorrect value if 'TYPES' has a trailing
5581 // 'bslmf::Nil' (unless the variant is declared using 'VariantN'). It is
5582 // arguably dubious to allow 'bslmf::Nil' as one of the types that a
5583 // variant may hold, but there is such use in production code that needs to
5584 // be considered if that "feature" is to be suppressed. This would do it:
5585 //..
5586 // BSLMF_ASSERT((!bsl::is_same<TYPE, bslmf::Nil>::value));
5587 //..
5588
5589 // TBD The following breaks compilation of some client code in C++11 mode
5590 // that is most likely misusing 'bslmf::Nil'.
5591 // BSLMF_ASSERT(((int)value <= (int)TYPES::LENGTH || 21 == value));
5592#endif
5593};
5594
5595 // ======================================
5596 // struct Variant_DefaultConstructVisitor
5597 // ======================================
5598
5599/// This visitor, when invoked as a non-modifiable function object on an
5600/// instance of some template parameter `TYPE`, will create a default
5601/// instance of `TYPE`.
5602struct Variant_DefaultConstructVisitor {
5603
5604 // PUBLIC DATA
5605 bslma::Allocator *d_allocator_p;
5606
5607 // CREATORS
5608 explicit
5609 Variant_DefaultConstructVisitor(bslma::Allocator *allocator)
5610 : d_allocator_p(allocator)
5611 {
5612 }
5613
5614 // ACCESSORS
5615 template <class TYPE>
5616 void operator()(TYPE& value) const
5617 {
5618 bslma::ConstructionUtil::construct(&value, d_allocator_p);
5619 }
5620};
5621
5622 // ===================================
5623 // struct Variant_CopyConstructVisitor
5624 // ===================================
5625
5626/// This visitor, when invoked as a non-modifiable function object on an
5627/// instance of some template parameter `TYPE`, will copy-insert that
5628/// instance to create an instance of the same `TYPE` in an uninitialized
5629/// buffer specified at construction of this visitor.
5630struct Variant_CopyConstructVisitor {
5631
5632 // PUBLIC DATA
5633 void *d_buffer_p;
5634 bslma::Allocator *d_allocator_p;
5635
5636 // CREATORS
5637 Variant_CopyConstructVisitor(void *buffer, bslma::Allocator *allocator)
5638 : d_buffer_p(buffer)
5639 , d_allocator_p(allocator)
5640 {
5641 BSLS_ASSERT_SAFE(d_buffer_p);
5642 }
5643
5644 // ACCESSORS
5645 template <class TYPE>
5646 void operator()(const TYPE& value) const
5647 {
5649 reinterpret_cast<TYPE *>(d_buffer_p),
5650 d_allocator_p,
5651 value);
5652 }
5653};
5654
5655 // ===================================
5656 // struct Variant_MoveConstructVisitor
5657 // ===================================
5658
5659/// This visitor, when invoked as a non-modifiable function object on an
5660/// instance of some template parameter `TYPE`, will move-insert that
5661/// instance to create an instance of the same `TYPE` in an uninitialized
5662/// buffer specified at construction of this visitor.
5663struct Variant_MoveConstructVisitor {
5664
5665 // PUBLIC DATA
5666 void *d_buffer_p;
5667 bslma::Allocator *d_allocator_p;
5668
5669 // CREATORS
5670 Variant_MoveConstructVisitor(void *buffer, bslma::Allocator *allocator)
5671 : d_buffer_p(buffer)
5672 , d_allocator_p(allocator)
5673 {
5674 BSLS_ASSERT_SAFE(d_buffer_p);
5675 }
5676
5677 // ACCESSORS
5678 template <class TYPE>
5679 void operator()(TYPE& value) const
5680 {
5682 reinterpret_cast<TYPE *>(d_buffer_p),
5683 d_allocator_p,
5685 }
5686};
5687
5688 // ================================
5689 // struct Variant_DestructorVisitor
5690 // ================================
5691
5692/// This visitor, when invoked as a function object on an instance of some
5693/// template parameter `TYPE`, will destroy that instance.
5694struct Variant_DestructorVisitor {
5695
5696 // ACCESSORS
5697 template <class TYPE>
5698 void operator()(TYPE& object) const
5699 {
5700 bslma::DestructionUtil::destroy(&object);
5701 }
5702};
5703
5704 // ================================
5705 // struct Variant_CopyAssignVisitor
5706 // ================================
5707
5708/// This visitor, when invoked as a non-modifiable function object on an
5709/// instance of some template parameter `TYPE`, will copy-assign that
5710/// instance to the instance of the same `TYPE` held in a buffer specified
5711/// at construction of this visitor.
5712struct Variant_CopyAssignVisitor {
5713
5714 // PUBLIC DATA
5715 void *d_buffer_p;
5716
5717 // CREATORS
5718 explicit
5719 Variant_CopyAssignVisitor(void *buffer)
5720 : d_buffer_p(buffer)
5721 {
5722 BSLS_ASSERT_SAFE(d_buffer_p);
5723 }
5724
5725 // ACCESSORS
5726 template <class TYPE>
5727 void operator()(const TYPE& value)
5728 {
5729 *reinterpret_cast<TYPE *>(d_buffer_p) = value;
5730 }
5731};
5732
5733 // ================================
5734 // struct Variant_MoveAssignVisitor
5735 // ================================
5736
5737/// This visitor, when invoked as a non-modifiable function object on an
5738/// instance of some template parameter `TYPE`, will move-assign that
5739/// instance to the instance of the same `TYPE` held in a buffer specified
5740/// at construction of this visitor.
5741struct Variant_MoveAssignVisitor {
5742
5743 // PUBLIC DATA
5744 void *d_buffer_p;
5745
5746 // CREATORS
5747 explicit
5748 Variant_MoveAssignVisitor(void *buffer)
5749 : d_buffer_p(buffer)
5750 {
5751 BSLS_ASSERT_SAFE(d_buffer_p);
5752 }
5753
5754 // ACCESSORS
5755 template <class TYPE>
5756 void operator()(TYPE& value)
5757 {
5758 *reinterpret_cast<TYPE *>(d_buffer_p) =
5760 }
5761};
5762
5763 // ==========================
5764 // struct Variant_SwapVisitor
5765 // ==========================
5766
5767/// This visitor swaps the variant object data that it holds with another
5768/// variant object data of parameterize `TYPE`. It requires that the two
5769/// variant objects being swapped contain data of the same type, and use the
5770/// same allocator.
5771struct Variant_SwapVisitor {
5772
5773 // PUBLIC DATA
5774 void *d_buffer_p;
5775
5776 // CREATORS
5777 explicit
5778 Variant_SwapVisitor(void *buffer)
5779 : d_buffer_p(buffer)
5780 {
5781 BSLS_ASSERT_SAFE(d_buffer_p);
5782 }
5783
5784 // MANIPULATORS
5785 template <class TYPE>
5786 void operator()(TYPE& value)
5787 {
5788 bslalg::SwapUtil::swap(reinterpret_cast<TYPE *>(d_buffer_p), &value);
5789 }
5790};
5791
5792#ifndef BDE_OMIT_INTERNAL_DEPRECATED
5793
5794 // ==================================
5795 // struct Variant_BdexStreamInVisitor
5796 // ==================================
5797
5798/// This visitor, when invoked as a non-modifiable function object on an
5799/// initialized instance of some parameterized `TYPE`, will stream in
5800/// a value of the same `TYPE` into that instance from a stream specified at
5801/// construction of this visitor, using a version also specified at
5802/// construction of this visitor.
5803template <class STREAM>
5804struct Variant_BdexStreamInVisitor {
5805
5806 // PUBLIC DATA
5807 STREAM& d_stream; // held, not owned
5808 int d_version; // BDEX version
5809
5810 // CREATORS
5811 Variant_BdexStreamInVisitor(STREAM& stream, int version)
5812 : d_stream(stream)
5813 , d_version(version)
5814 {
5815 }
5816
5817 // ACCESSORS
5818 template <class VALUETYPE>
5819 inline
5820 void operator()(VALUETYPE& object) const
5821 {
5822 bslx::InStreamFunctions::bdexStreamIn(d_stream, object, d_version);
5823 }
5824
5825 inline
5826 void operator()(bslmf::Nil) const
5827 {
5828 // no op
5829 }
5830};
5831
5832 // ===================================
5833 // struct Variant_BdexStreamOutVisitor
5834 // ===================================
5835
5836/// This visitor, when invoked as a non-modifiable function object on an
5837/// initialized instance of some parameterized `TYPE`, will stream out the
5838/// value of that instance into a stream specified at construction of this
5839/// visitor, using a version also specified at construction of this
5840/// visitor.
5841template <class STREAM>
5842struct Variant_BdexStreamOutVisitor {
5843
5844 // PUBLIC DATA
5845 STREAM& d_stream; // held, not owned
5846 int d_version; // BDEX version
5847
5848 // CREATORS
5849 Variant_BdexStreamOutVisitor(STREAM& stream, int version)
5850 : d_stream(stream)
5851 , d_version(version)
5852 {
5853 }
5854
5855 // ACCESSORS
5856 template <class VALUETYPE>
5857 inline
5858 void operator()(const VALUETYPE& object) const
5859 {
5860 bslx::OutStreamFunctions::bdexStreamOut(d_stream, object, d_version);
5861 }
5862
5863 inline
5864 void operator()(bslmf::Nil) const
5865 {
5866 // no op
5867 }
5868};
5869#endif
5870
5871 // ===========================
5872 // struct Variant_PrintVisitor
5873 // ===========================
5874
5875/// This visitor, when invoked as a non-modifiable function object on an
5876/// instance of some template parameter `TYPE`, writes the value of that
5877/// instance to a stream specified at construction of this visitor, using
5878/// spacing information also specified at construction.
5879struct Variant_PrintVisitor {
5880
5881 // PUBLIC DATA
5882 bsl::ostream *d_stream_p; // held, not owned
5883 int d_level;
5884 int d_spacesPerLevel;
5885
5886 // CREATORS
5887 Variant_PrintVisitor(bsl::ostream *stream,
5888 int level,
5889 int spacesPerLevel)
5890 : d_stream_p(stream)
5891 , d_level(level)
5892 , d_spacesPerLevel(spacesPerLevel)
5893 {
5894 BSLS_ASSERT_SAFE(d_stream_p);
5895 }
5896
5897 // ACCESSORS
5898 template <class TYPE>
5899 void operator()(const TYPE& value) const
5900 {
5901 PrintMethods::print(*d_stream_p, value, d_level, d_spacesPerLevel);
5902 }
5903
5904 void operator()(bslmf::Nil) const
5905 {
5906 // no op
5907 }
5908};
5909
5910 // ==================================
5911 // struct Variant_EqualityTestVisitor
5912 // ==================================
5913
5914/// This visitor, when invoked as a non-modifiable function object on an
5915/// instance of some template parameter `TYPE`, tests the equality of the
5916/// value of that instance and of another instance held in a buffer
5917/// specified at construction of this visitor, and stores the result into
5918/// its publicly accessible `d_result` member.
5919struct Variant_EqualityTestVisitor {
5920
5921 // PUBLIC DATA
5922 mutable bool d_result;
5923 const void *d_buffer_p; // held, not owned
5924
5925 // CREATORS
5926 explicit
5927 Variant_EqualityTestVisitor(const void *buffer)
5928 : d_result(true)
5929 , d_buffer_p(buffer)
5930 {
5931 BSLS_ASSERT_SAFE(d_buffer_p);
5932 }
5933
5934 // ACCESSORS
5935 template <class TYPE>
5936 void operator()(const TYPE& value) const
5937 {
5938 d_result = *reinterpret_cast<const TYPE *>(d_buffer_p) == value;
5939 }
5940
5941 void operator()(bslmf::Nil) const
5942 {
5943 d_result = true;
5944 }
5945};
5946
5947// ============================================================================
5948// INLINE DEFINITIONS
5949// ============================================================================
5950
5951 // -------------------------------------
5952 // class VariantImp_AllocatorBase<TYPES>
5953 // -------------------------------------
5954
5955// CREATORS
5956template <class TYPES>
5957inline
5959VariantImp_AllocatorBase(int type, bslma::Allocator *basicAllocator)
5960: d_type(type)
5961, d_allocator_p(bslma::Default::allocator(basicAllocator))
5962{
5963}
5964
5965template <class TYPES>
5966inline
5967VariantImp_AllocatorBase<TYPES>::
5968VariantImp_AllocatorBase(int, bslma::Allocator *basicAllocator, bsl::true_type)
5969: d_type(0)
5970, d_allocator_p(bslma::Default::allocator(basicAllocator))
5971{
5972}
5973
5974template <class TYPES>
5975template <class TYPE>
5976inline
5977VariantImp_AllocatorBase<TYPES>::
5978VariantImp_AllocatorBase(int type, const TYPE&, bsl::false_type)
5979: d_type(type)
5980, d_allocator_p(bslma::Default::allocator(0))
5981{
5982}
5983
5984// ACCESSORS
5985template <class TYPES>
5986inline
5988VariantImp_AllocatorBase<TYPES>::getAllocator() const
5989{
5990 return d_allocator_p;
5991}
5992
5993 // ---------------------------------------
5994 // class VariantImp_NoAllocatorBase<TYPES>
5995 // ---------------------------------------
5996
5997// CREATORS
5998template <class TYPES>
5999inline
6000VariantImp_NoAllocatorBase<TYPES>::
6001VariantImp_NoAllocatorBase(int type, bslma::Allocator *)
6002: d_type(type)
6003{
6004}
6005
6006template <class TYPES>
6007inline
6008VariantImp_NoAllocatorBase<TYPES>::
6009VariantImp_NoAllocatorBase(int, bslma::Allocator *, bsl::true_type)
6010: d_type(0)
6011{
6012}
6013
6014template <class TYPES>
6015template <class TYPE>
6016inline
6017VariantImp_NoAllocatorBase<TYPES>::
6018VariantImp_NoAllocatorBase(int type, const TYPE&, bsl::false_type)
6019: d_type(type)
6020{
6021}
6022
6023// ACCESSORS
6024template <class TYPES>
6025inline
6027VariantImp_NoAllocatorBase<TYPES>::getAllocator() const
6028{
6029 return 0;
6030}
6031
6032 // ------------------------------
6033 // class Variant_RawVisitorHelper
6034 // ------------------------------
6035
6036// CREATORS
6037template <class RESULT_TYPE, class VISITOR>
6038inline
6039Variant_RawVisitorHelper<RESULT_TYPE, VISITOR>::
6040Variant_RawVisitorHelper(VISITOR *visitor)
6041: d_visitor(visitor)
6042{
6043 BSLS_ASSERT_SAFE(0 != visitor);
6044}
6045
6046// MANIPULATORS
6047template <class RESULT_TYPE, class VISITOR>
6048template <class ARGUMENT_TYPE>
6049inline
6050RESULT_TYPE
6051Variant_RawVisitorHelper<RESULT_TYPE, VISITOR>::operator()(
6052 ARGUMENT_TYPE& argument)
6053{
6054 return static_cast<RESULT_TYPE>((*d_visitor)(argument));
6055}
6056
6057template <class RESULT_TYPE, class VISITOR>
6058template <class ARGUMENT_TYPE>
6059inline
6060RESULT_TYPE
6061Variant_RawVisitorHelper<RESULT_TYPE, VISITOR>::operator()(
6062 const ARGUMENT_TYPE& argument)
6063{
6064 return static_cast<RESULT_TYPE>((*d_visitor)(argument));
6065}
6066
6067// ACCESSORS
6068template <class RESULT_TYPE, class VISITOR>
6069template <class ARGUMENT_TYPE>
6070inline
6071RESULT_TYPE
6072Variant_RawVisitorHelper<RESULT_TYPE, VISITOR>::operator()(
6073 ARGUMENT_TYPE& argument) const
6074{
6075 return static_cast<RESULT_TYPE>((*d_visitor)(argument));
6076}
6077
6078template <class RESULT_TYPE, class VISITOR>
6079template <class ARGUMENT_TYPE>
6080inline
6081RESULT_TYPE
6082Variant_RawVisitorHelper<RESULT_TYPE, VISITOR>::operator()(
6083 const ARGUMENT_TYPE& argument) const
6084{
6085 return static_cast<RESULT_TYPE>((*d_visitor)(argument));
6086}
6087
6088template <class RESULT_TYPE, class VISITOR>
6089RESULT_TYPE
6090Variant_RawVisitorHelper<RESULT_TYPE, VISITOR>::operator()(bslmf::Nil) const
6091{
6092 BSLS_ASSERT_INVOKE_NORETURN("unreachable");
6093}
6094
6095 // -----------------------
6096 // class VariantImp<TYPES>
6097 // -----------------------
6098
6099// PRIVATE MANIPULATORS
6100template <class TYPES>
6101template <class TYPE, class VISITOR_REF>
6102inline
6103void VariantImp<TYPES>::applyImp(VISITOR_REF visitor, bsl::false_type)
6104{
6105 typedef bsls::ObjectBuffer<TYPE> BufferType;
6106
6107 visitor(reinterpret_cast<BufferType *>(&this->d_value)->object());
6108}
6109
6110template <class TYPES>
6111template <class TYPE, class VISITOR_REF>
6112inline
6113void VariantImp<TYPES>::applyImp(VISITOR_REF visitor, bsl::true_type)
6114{
6115 bslmf::Nil nil = bslmf::Nil();
6116 visitor(nil);
6117}
6118
6119template <class TYPES>
6120template <class TYPE, class VISITOR_REF>
6121inline
6122void VariantImp<TYPES>::applyImp(VISITOR_REF visitor)
6123{
6124 typedef typename bsl::is_same<TYPE, bslmf::Nil>::type IsUnset;
6125 applyImp<TYPE, VISITOR_REF>(visitor, IsUnset());
6126}
6127
6128template <class TYPES>
6129template <class TYPE, class VISITOR_REF, class RET_TYPE>
6130inline
6131RET_TYPE VariantImp<TYPES>::applyImpR(VISITOR_REF visitor, bsl::false_type)
6132{
6133 typedef bsls::ObjectBuffer<TYPE> BufferType;
6134
6135 return visitor(reinterpret_cast<BufferType *>(&this->d_value)->object());
6136}
6137
6138template <class TYPES>
6139template <class TYPE, class VISITOR_REF, class RET_TYPE>
6140inline
6141RET_TYPE VariantImp<TYPES>::applyImpR(VISITOR_REF visitor, bsl::true_type)
6142{
6143 bslmf::Nil nil = bslmf::Nil();
6144 return visitor(nil);
6145}
6146
6147template <class TYPES>
6148template <class TYPE, class VISITOR_REF, class RET_TYPE>
6149inline
6150RET_TYPE VariantImp<TYPES>::applyImpR(VISITOR_REF visitor)
6151{
6152 typedef typename bsl::is_same<TYPE, bslmf::Nil>::type IsUnset;
6153 return applyImpR<TYPE, VISITOR_REF, RET_TYPE>(visitor, IsUnset());
6154}
6155
6156template <class TYPES>
6157template <class TYPE, class SOURCE_TYPE>
6158void VariantImp<TYPES>::assignImp(const SOURCE_TYPE& value)
6159{
6160 typedef bsls::ObjectBuffer<TYPE> BufferType;
6161
6162 reset();
6164 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6165 this->getAllocator(),
6166 value);
6167 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
6168}
6169
6170template <class TYPES>
6171template <class TYPE>
6172#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6173void VariantImp<TYPES>::assignImp(TYPE&& value)
6174#else
6175void VariantImp<TYPES>::assignImp(bslmf::MovableRef<TYPE> value)
6176#endif
6177{
6179 BufferType;
6180
6181 reset();
6182
6183#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6185 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6186 this->getAllocator(),
6187 BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
6188#else
6189 TYPE& lvalue = value;
6191 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6192 this->getAllocator(),
6194#endif
6195
6196 this->d_type =
6197 Variant_TypeIndex<TYPES,
6198 typename bsl::remove_reference<TYPE>::type>::value;
6199}
6200
6201template <class TYPES>
6202template <class VISITOR_REF>
6203void VariantImp<TYPES>::doApply(VISITOR_REF visitor, int type)
6204{
6205 switch (type) {
6206 case 0: {
6207 BSLS_ASSERT(0 == "'doApply' invoked on an unset variant");
6208 } break;
6209 case 1: {
6210 applyImp<typename Base::Type1, VISITOR_REF>(visitor);
6211 } break;
6212 case 2: {
6213 applyImp<typename Base::Type2, VISITOR_REF>(visitor);
6214 } break;
6215 case 3: {
6216 applyImp<typename Base::Type3, VISITOR_REF>(visitor);
6217 } break;
6218 case 4: {
6219 applyImp<typename Base::Type4, VISITOR_REF>(visitor);
6220 } break;
6221 case 5: {
6222 applyImp<typename Base::Type5, VISITOR_REF>(visitor);
6223 } break;
6224 case 6: {
6225 applyImp<typename Base::Type6, VISITOR_REF>(visitor);
6226 } break;
6227 case 7: {
6228 applyImp<typename Base::Type7, VISITOR_REF>(visitor);
6229 } break;
6230 case 8: {
6231 applyImp<typename Base::Type8, VISITOR_REF>(visitor);
6232 } break;
6233 case 9: {
6234 applyImp<typename Base::Type9, VISITOR_REF>(visitor);
6235 } break;
6236 case 10: {
6237 applyImp<typename Base::Type10, VISITOR_REF>(visitor);
6238 } break;
6239 case 11: {
6240 applyImp<typename Base::Type11, VISITOR_REF>(visitor);
6241 } break;
6242 case 12: {
6243 applyImp<typename Base::Type12, VISITOR_REF>(visitor);
6244 } break;
6245 case 13: {
6246 applyImp<typename Base::Type13, VISITOR_REF>(visitor);
6247 } break;
6248 case 14: {
6249 applyImp<typename Base::Type14, VISITOR_REF>(visitor);
6250 } break;
6251 case 15: {
6252 applyImp<typename Base::Type15, VISITOR_REF>(visitor);
6253 } break;
6254 case 16: {
6255 applyImp<typename Base::Type16, VISITOR_REF>(visitor);
6256 } break;
6257 case 17: {
6258 applyImp<typename Base::Type17, VISITOR_REF>(visitor);
6259 } break;
6260 case 18: {
6261 applyImp<typename Base::Type18, VISITOR_REF>(visitor);
6262 } break;
6263 case 19: {
6264 applyImp<typename Base::Type19, VISITOR_REF>(visitor);
6265 } break;
6266 case 20: {
6267 applyImp<typename Base::Type20, VISITOR_REF>(visitor);
6268 } break;
6269 default: {
6270 BSLS_ASSERT(0 == "Unreachable by design!");
6271 } break;
6272 }
6273}
6274
6275template <class TYPES>
6276template <class TYPE>
6277inline
6278void VariantImp<TYPES>::create(const TYPE& value, bsl::false_type)
6279{
6280 typedef bsls::ObjectBuffer<TYPE> BufferType;
6281
6283 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6284 this->getAllocator(),
6285 value);
6286}
6287
6288template <class TYPES>
6289inline
6290void VariantImp<TYPES>::create(bslma::Allocator *, bsl::true_type)
6291{
6292}
6293
6294template <class TYPES>
6295template <class VISITOR_REF, class RET_TYPE>
6296RET_TYPE VariantImp<TYPES>::doApplyR(VISITOR_REF visitor, int type)
6297{
6298 switch (type) {
6299 case 0: {
6300 BSLS_ASSERT_INVOKE_NORETURN("'doApplyR' invoked on an unset variant");
6301 } break;
6302 case 1: {
6303 return applyImpR<typename Base::Type1,
6304 VISITOR_REF,
6305 RET_TYPE>(visitor); // RETURN
6306 } break;
6307 case 2: {
6308 return applyImpR<typename Base::Type2,
6309 VISITOR_REF,
6310 RET_TYPE>(visitor); // RETURN
6311 } break;
6312 case 3: {
6313 return applyImpR<typename Base::Type3,
6314 VISITOR_REF,
6315 RET_TYPE>(visitor); // RETURN
6316 } break;
6317 case 4: {
6318 return applyImpR<typename Base::Type4,
6319 VISITOR_REF,
6320 RET_TYPE>(visitor); // RETURN
6321 } break;
6322 case 5: {
6323 return applyImpR<typename Base::Type5,
6324 VISITOR_REF,
6325 RET_TYPE>(visitor); // RETURN
6326 } break;
6327 case 6: {
6328 return applyImpR<typename Base::Type6,
6329 VISITOR_REF,
6330 RET_TYPE>(visitor); // RETURN
6331 } break;
6332 case 7: {
6333 return applyImpR<typename Base::Type7,
6334 VISITOR_REF,
6335 RET_TYPE>(visitor); // RETURN
6336 } break;
6337 case 8: {
6338 return applyImpR<typename Base::Type8,
6339 VISITOR_REF,
6340 RET_TYPE>(visitor); // RETURN
6341 } break;
6342 case 9: {
6343 return applyImpR<typename Base::Type9,
6344 VISITOR_REF,
6345 RET_TYPE>(visitor); // RETURN
6346 } break;
6347 case 10: {
6348 return applyImpR<typename Base::Type10,
6349 VISITOR_REF,
6350 RET_TYPE>(visitor); // RETURN
6351 } break;
6352 case 11: {
6353 return applyImpR<typename Base::Type11,
6354 VISITOR_REF,
6355 RET_TYPE>(visitor); // RETURN
6356 } break;
6357 case 12: {
6358 return applyImpR<typename Base::Type12,
6359 VISITOR_REF,
6360 RET_TYPE>(visitor); // RETURN
6361 } break;
6362 case 13: {
6363 return applyImpR<typename Base::Type13,
6364 VISITOR_REF,
6365 RET_TYPE>(visitor); // RETURN
6366 } break;
6367 case 14: {
6368 return applyImpR<typename Base::Type14,
6369 VISITOR_REF,
6370 RET_TYPE>(visitor); // RETURN
6371 } break;
6372 case 15: {
6373 return applyImpR<typename Base::Type15,
6374 VISITOR_REF,
6375 RET_TYPE>(visitor); // RETURN
6376 } break;
6377 case 16: {
6378 return applyImpR<typename Base::Type16,
6379 VISITOR_REF,
6380 RET_TYPE>(visitor); // RETURN
6381 } break;
6382 case 17: {
6383 return applyImpR<typename Base::Type17,
6384 VISITOR_REF,
6385 RET_TYPE>(visitor); // RETURN
6386 } break;
6387 case 18: {
6388 return applyImpR<typename Base::Type18,
6389 VISITOR_REF,
6390 RET_TYPE>(visitor); // RETURN
6391 } break;
6392 case 19: {
6393 return applyImpR<typename Base::Type19,
6394 VISITOR_REF,
6395 RET_TYPE>(visitor); // RETURN
6396 } break;
6397 case 20: {
6398 return applyImpR<typename Base::Type20,
6399 VISITOR_REF,
6400 RET_TYPE>(visitor); // RETURN
6401 } break;
6402 default: {
6403 BSLS_ASSERT_INVOKE_NORETURN("Unreachable by design!");
6404 } break;
6405 }
6406}
6407
6408// PRIVATE ACCESSORS
6409template <class TYPES>
6410template <class TYPE, class VISITOR_REF>
6411inline
6412void VariantImp<TYPES>::applyImp(VISITOR_REF visitor, bsl::false_type) const
6413{
6414 typedef bsls::ObjectBuffer<TYPE> BufferType;
6415
6416 visitor(reinterpret_cast<const BufferType *>(&this->d_value)->object());
6417}
6418
6419template <class TYPES>
6420template <class TYPE, class VISITOR_REF>
6421inline
6422void VariantImp<TYPES>::applyImp(VISITOR_REF visitor, bsl::true_type) const
6423{
6424 bslmf::Nil nil = bslmf::Nil();
6425 visitor(nil);
6426}
6427
6428template <class TYPES>
6429template <class TYPE, class VISITOR_REF>
6430inline
6431void VariantImp<TYPES>::applyImp(VISITOR_REF visitor) const
6432{
6433 typedef typename bsl::is_same<TYPE, bslmf::Nil>::type IsUnset;
6434 applyImp<TYPE, VISITOR_REF>(visitor, IsUnset());
6435}
6436
6437template <class TYPES>
6438template <class TYPE, class VISITOR_REF, class RET_TYPE>
6439inline
6440RET_TYPE VariantImp<TYPES>::applyImpR(VISITOR_REF visitor,
6441 bsl::false_type) const
6442{
6443 typedef bsls::ObjectBuffer<TYPE> BufferType;
6444
6445 return visitor(reinterpret_cast<const BufferType *>(
6446 &this->d_value)->object());
6447}
6448
6449template <class TYPES>
6450template <class TYPE, class VISITOR_REF, class RET_TYPE>
6451inline
6452RET_TYPE VariantImp<TYPES>::applyImpR(VISITOR_REF visitor,
6453 bsl::true_type) const
6454{
6455 bslmf::Nil nil = bslmf::Nil();
6456 return visitor(nil);
6457}
6458
6459template <class TYPES>
6460template <class TYPE, class VISITOR_REF, class RET_TYPE>
6461inline
6462RET_TYPE VariantImp<TYPES>::applyImpR(VISITOR_REF visitor) const
6463{
6464 typedef typename bsl::is_same<TYPE, bslmf::Nil>::type IsUnset;
6465 return applyImpR<TYPE, VISITOR_REF, RET_TYPE>(visitor, IsUnset());
6466}
6467
6468template <class TYPES>
6469template <class VISITOR_REF>
6470void VariantImp<TYPES>::doApply(VISITOR_REF visitor, int type) const
6471{
6472 switch (type) {
6473 case 0: {
6474 BSLS_ASSERT_INVOKE_NORETURN("'doApply' invoked on an unset variant");
6475 } break;
6476 case 1: {
6477 applyImp<typename Base::Type1, VISITOR_REF>(visitor);
6478 } break;
6479 case 2: {
6480 applyImp<typename Base::Type2, VISITOR_REF>(visitor);
6481 } break;
6482 case 3: {
6483 applyImp<typename Base::Type3, VISITOR_REF>(visitor);
6484 } break;
6485 case 4: {
6486 applyImp<typename Base::Type4, VISITOR_REF>(visitor);
6487 } break;
6488 case 5: {
6489 applyImp<typename Base::Type5, VISITOR_REF>(visitor);
6490 } break;
6491 case 6: {
6492 applyImp<typename Base::Type6, VISITOR_REF>(visitor);
6493 } break;
6494 case 7: {
6495 applyImp<typename Base::Type7, VISITOR_REF>(visitor);
6496 } break;
6497 case 8: {
6498 applyImp<typename Base::Type8, VISITOR_REF>(visitor);
6499 } break;
6500 case 9: {
6501 applyImp<typename Base::Type9, VISITOR_REF>(visitor);
6502 } break;
6503 case 10: {
6504 applyImp<typename Base::Type10, VISITOR_REF>(visitor);
6505 } break;
6506 case 11: {
6507 applyImp<typename Base::Type11, VISITOR_REF>(visitor);
6508 } break;
6509 case 12: {
6510 applyImp<typename Base::Type12, VISITOR_REF>(visitor);
6511 } break;
6512 case 13: {
6513 applyImp<typename Base::Type13, VISITOR_REF>(visitor);
6514 } break;
6515 case 14: {
6516 applyImp<typename Base::Type14, VISITOR_REF>(visitor);
6517 } break;
6518 case 15: {
6519 applyImp<typename Base::Type15, VISITOR_REF>(visitor);
6520 } break;
6521 case 16: {
6522 applyImp<typename Base::Type16, VISITOR_REF>(visitor);
6523 } break;
6524 case 17: {
6525 applyImp<typename Base::Type17, VISITOR_REF>(visitor);
6526 } break;
6527 case 18: {
6528 applyImp<typename Base::Type18, VISITOR_REF>(visitor);
6529 } break;
6530 case 19: {
6531 applyImp<typename Base::Type19, VISITOR_REF>(visitor);
6532 } break;
6533 case 20: {
6534 applyImp<typename Base::Type20, VISITOR_REF>(visitor);
6535 } break;
6536 default: {
6537 BSLS_ASSERT_INVOKE_NORETURN("Unreachable by design!");
6538 } break;
6539 }
6540}
6541
6542template <class TYPES>
6543template <class VISITOR_REF, class RET_TYPE>
6544RET_TYPE VariantImp<TYPES>::doApplyR(VISITOR_REF visitor, int type) const
6545{
6546 switch (type) {
6547 case 0: {
6548 BSLS_ASSERT_INVOKE_NORETURN("'doApplyR' invoked on an unset variant");
6549 } break;
6550 case 1: {
6551 return applyImpR<typename Base::Type1,
6552 VISITOR_REF,
6553 RET_TYPE>(visitor); // RETURN
6554 } break;
6555 case 2: {
6556 return applyImpR<typename Base::Type2,
6557 VISITOR_REF,
6558 RET_TYPE>(visitor); // RETURN
6559 } break;
6560 case 3: {
6561 return applyImpR<typename Base::Type3,
6562 VISITOR_REF,
6563 RET_TYPE>(visitor); // RETURN
6564 } break;
6565 case 4: {
6566 return applyImpR<typename Base::Type4,
6567 VISITOR_REF,
6568 RET_TYPE>(visitor); // RETURN
6569 } break;
6570 case 5: {
6571 return applyImpR<typename Base::Type5,
6572 VISITOR_REF,
6573 RET_TYPE>(visitor); // RETURN
6574 } break;
6575 case 6: {
6576 return applyImpR<typename Base::Type6,
6577 VISITOR_REF,
6578 RET_TYPE>(visitor); // RETURN
6579 } break;
6580 case 7: {
6581 return applyImpR<typename Base::Type7,
6582 VISITOR_REF,
6583 RET_TYPE>(visitor); // RETURN
6584 } break;
6585 case 8: {
6586 return applyImpR<typename Base::Type8,
6587 VISITOR_REF,
6588 RET_TYPE>(visitor); // RETURN
6589 } break;
6590 case 9: {
6591 return applyImpR<typename Base::Type9,
6592 VISITOR_REF,
6593 RET_TYPE>(visitor); // RETURN
6594 } break;
6595 case 10: {
6596 return applyImpR<typename Base::Type10,
6597 VISITOR_REF,
6598 RET_TYPE>(visitor); // RETURN
6599 } break;
6600 case 11: {
6601 return applyImpR<typename Base::Type11,
6602 VISITOR_REF,
6603 RET_TYPE>(visitor); // RETURN
6604 } break;
6605 case 12: {
6606 return applyImpR<typename Base::Type12,
6607 VISITOR_REF,
6608 RET_TYPE>(visitor); // RETURN
6609 } break;
6610 case 13: {
6611 return applyImpR<typename Base::Type13,
6612 VISITOR_REF,
6613 RET_TYPE>(visitor); // RETURN
6614 } break;
6615 case 14: {
6616 return applyImpR<typename Base::Type14,
6617 VISITOR_REF,
6618 RET_TYPE>(visitor); // RETURN
6619 } break;
6620 case 15: {
6621 return applyImpR<typename Base::Type15,
6622 VISITOR_REF,
6623 RET_TYPE>(visitor); // RETURN
6624 } break;
6625 case 16: {
6626 return applyImpR<typename Base::Type16,
6627 VISITOR_REF,
6628 RET_TYPE>(visitor); // RETURN
6629 } break;
6630 case 17: {
6631 return applyImpR<typename Base::Type17,
6632 VISITOR_REF,
6633 RET_TYPE>(visitor); // RETURN
6634 } break;
6635 case 18: {
6636 return applyImpR<typename Base::Type18,
6637 VISITOR_REF,
6638 RET_TYPE>(visitor); // RETURN
6639 } break;
6640 case 19: {
6641 return applyImpR<typename Base::Type19,
6642 VISITOR_REF,
6643 RET_TYPE>(visitor); // RETURN
6644 } break;
6645 case 20: {
6646 return applyImpR<typename Base::Type20,
6647 VISITOR_REF,
6648 RET_TYPE>(visitor); // RETURN
6649 } break;
6650 default: {
6651 BSLS_ASSERT_INVOKE_NORETURN("Unreachable by design!");
6652 } break;
6653 }
6654}
6655
6656// CREATORS
6657template <class TYPES>
6658inline
6659VariantImp<TYPES>::VariantImp()
6660: Base(0, 0)
6661{
6662}
6663
6664template <class TYPES>
6665template <class TYPE_OR_ALLOCATOR>
6666inline
6667VariantImp<TYPES>::VariantImp(const TYPE_OR_ALLOCATOR& valueOrAllocator)
6668: Base(Variant_TypeIndex<TYPES, TYPE_OR_ALLOCATOR>::value,
6669 valueOrAllocator,
6670 bsl::integral_constant<bool, bsl::is_convertible<TYPE_OR_ALLOCATOR,
6671 bslma::Allocator *>::value>())
6672{
6673 enum {
6674 k_IS_ALLOCATOR = bsl::is_convertible<TYPE_OR_ALLOCATOR,
6675 bslma::Allocator *>::value
6676 };
6677
6678 create(valueOrAllocator, bsl::integral_constant<bool, k_IS_ALLOCATOR>());
6679}
6680
6681template <class TYPES>
6682template <class TYPE>
6683inline
6684VariantImp<TYPES>::VariantImp(const TYPE& value,
6685 bslma::Allocator *basicAllocator)
6686: Base(Variant_TypeIndex<TYPES, TYPE>::value, basicAllocator)
6687{
6688 typedef bsls::ObjectBuffer<TYPE> BufferType;
6689
6691 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6692 this->getAllocator(),
6693 value);
6694}
6695
6696template <class TYPES>
6697template <class TYPE>
6698VariantImp<TYPES>::
6699#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6700VariantImp(TYPE&& value,
6701 typename bsl::enable_if<
6702 !bsl::is_same<
6703 SelfType,
6704 typename bsl::remove_const<
6705 typename bsl::remove_reference<TYPE>::type>::type>::value
6706 &&
6708 void>::type *)
6709#else
6710VariantImp(bslmf::MovableRef<TYPE> value)
6711#endif
6712: Base(Variant_TypeIndex<
6713 TYPES,
6714 typename bsl::remove_const<
6715 typename bsl::remove_reference<TYPE>::type>::type>::value,
6716 0)
6717{
6718 typedef bsls::ObjectBuffer<
6719 typename bsl::remove_const<
6720 typename bsl::remove_reference<TYPE>::type>::type> BufferType;
6721
6722#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6724 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6725 this->getAllocator(),
6726 BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
6727#else
6728 TYPE& lvalue = value;
6730 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6731 this->getAllocator(),
6733#endif
6734}
6735
6736template <class TYPES>
6737template <class TYPE>
6738VariantImp<TYPES>::
6739#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6740VariantImp(TYPE&& value,
6741 typename bsl::enable_if<
6742 !bsl::is_same<
6743 SelfType,
6744 typename bsl::remove_const<
6745 typename bsl::remove_reference<TYPE>::type>::type>::value,
6746 bslma::Allocator>::type *basicAllocator)
6747#else
6748VariantImp(bslmf::MovableRef<TYPE> value,
6749 bslma::Allocator *basicAllocator)
6750#endif
6751: Base(Variant_TypeIndex<
6752 TYPES,
6753 typename bsl::remove_const<
6754 typename bsl::remove_reference<TYPE>::type>::type>::value,
6755 basicAllocator)
6756{
6757 typedef bsls::ObjectBuffer<
6758 typename bsl::remove_const<
6759 typename bsl::remove_reference<TYPE>::type>::type> BufferType;
6760
6761#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6763 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6764 this->getAllocator(),
6765 BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
6766#else
6767 TYPE& lvalue = value;
6769 reinterpret_cast<BufferType *>(&this->d_value)->address(),
6770 this->getAllocator(),
6772#endif
6773}
6774
6775template <class TYPES>
6776VariantImp<TYPES>::VariantImp(const VariantImp& original,
6777 bslma::Allocator *basicAllocator)
6778: Base(original.d_type, basicAllocator)
6779{
6780 if (this->d_type) {
6781 Variant_CopyConstructVisitor copyConstructor(&this->d_value,
6782 this->getAllocator());
6783 original.apply(copyConstructor);
6784 }
6785}
6786
6787template <class TYPES>
6788VariantImp<TYPES>::VariantImp(bslmf::MovableRef<VariantImp> original)
6789: Base(MoveUtil::access(original).d_type,
6790 MoveUtil::access(original).getAllocator())
6791{
6792 if (this->d_type) {
6793 Variant_MoveConstructVisitor moveConstructor(&this->d_value,
6794 this->getAllocator());
6795 VariantImp& lvalue = original;
6796
6797 lvalue.apply(moveConstructor);
6798 }
6799}
6800
6801template <class TYPES>
6802VariantImp<TYPES>::VariantImp(bslmf::MovableRef<VariantImp> original,
6803 bslma::Allocator *basicAllocator)
6804: Base(MoveUtil::access(original).d_type, basicAllocator)
6805{
6806 if (this->d_type) {
6807 Variant_MoveConstructVisitor moveConstructor(&this->d_value,
6808 this->getAllocator());
6809 VariantImp& lvalue = original;
6810
6811 lvalue.apply(moveConstructor);
6812 }
6813}
6814
6815template <class TYPES>
6816inline
6817VariantImp<TYPES>::~VariantImp()
6818{
6819 reset();
6820}
6821
6822// MANIPULATORS
6823template <class TYPES>
6824template <class TYPE>
6825inline
6826VariantImp<TYPES>&
6827VariantImp<TYPES>::operator=(const TYPE& value)
6828{
6829 return assign(value);
6830}
6831
6832template <class TYPES>
6833template <class TYPE>
6834inline
6835#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6836typename bsl::enable_if<
6838 typename bsl::remove_cvref<TYPE>::type>::value,
6839VariantImp<TYPES> >::type&
6840VariantImp<TYPES>::operator=(TYPE&& value)
6841#else
6842VariantImp<TYPES>&
6843VariantImp<TYPES>::operator=(bslmf::MovableRef<TYPE> value)
6844#endif
6845{
6846#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
6847 return assign(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
6848#else
6849 TYPE& lvalue = value;
6850 return assign(MoveUtil::move(lvalue));
6851#endif
6852}
6853
6854template <class TYPES>
6855VariantImp<TYPES>&
6856VariantImp<TYPES>::operator=(const VariantImp& rhs)
6857{
6858 if (&rhs != this) {
6859 if (this->d_type == rhs.d_type) {
6860 if (this->d_type) {
6861 Variant_CopyAssignVisitor assigner(&this->d_value);
6862 rhs.apply(assigner);
6863 }
6864 }
6865 else {
6866 reset();
6867 if (rhs.d_type) {
6868 Variant_CopyConstructVisitor copyConstructor(
6869 &this->d_value,
6870 this->getAllocator());
6871 rhs.apply(copyConstructor);
6872 this->d_type = rhs.d_type;
6873 }
6874 }
6875 }
6876
6877 return *this;
6878}
6879
6880template <class TYPES>
6881VariantImp<TYPES>&
6882VariantImp<TYPES>::operator=(bslmf::MovableRef<VariantImp> rhs)
6883{
6884 VariantImp& lvalue = rhs;
6885
6886 if (&lvalue != this) {
6887 if (this->d_type == lvalue.d_type) {
6888 if (this->d_type) {
6889 Variant_MoveAssignVisitor assigner(&this->d_value);
6890 lvalue.apply(assigner);
6891 }
6892 }
6893 else {
6894 reset();
6895 if (lvalue.d_type) {
6896 Variant_MoveConstructVisitor moveConstructor(
6897 &this->d_value,
6898 this->getAllocator());
6899 lvalue.apply(moveConstructor);
6900 this->d_type = lvalue.d_type;
6901 }
6902 }
6903 }
6904
6905 return *this;
6906}
6907
6908template <class TYPES>
6909template <class RET_TYPE, class VISITOR>
6910inline
6911RET_TYPE VariantImp<TYPES>::apply(VISITOR& visitor)
6912{
6913 if (this->d_type) {
6914 return doApplyR<VISITOR&, RET_TYPE>(visitor, this->d_type); // RETURN
6915 }
6916
6917 bslmf::Nil nil = bslmf::Nil();
6918 return visitor(nil);
6919}
6920
6921template <class TYPES>
6922template <class RET_TYPE, class VISITOR>
6923inline
6924RET_TYPE VariantImp<TYPES>::apply(const VISITOR& visitor)
6925{
6926 if (this->d_type) {
6927 return doApplyR<const VISITOR&, RET_TYPE>(visitor, this->d_type);
6928 // RETURN
6929 }
6930
6931 bslmf::Nil nil = bslmf::Nil();
6932 return visitor(nil);
6933}
6934
6935template <class TYPES>
6936template <class RET_TYPE, class VISITOR, class TYPE>
6937inline
6938RET_TYPE VariantImp<TYPES>::apply(VISITOR& visitor, const TYPE& defaultValue)
6939{
6940 if (this->d_type) {
6941 return doApplyR<VISITOR&, RET_TYPE>(visitor, this->d_type); // RETURN
6942 }
6943
6944 return visitor(defaultValue);
6945}
6946
6947template <class TYPES>
6948template <class RET_TYPE, class VISITOR, class TYPE>
6949inline
6950RET_TYPE VariantImp<TYPES>::apply(const VISITOR& visitor,
6951 const TYPE& defaultValue)
6952{
6953 if (this->d_type) {
6954 return doApplyR<const VISITOR&, RET_TYPE>(visitor, this->d_type);
6955 // RETURN
6956 }
6957
6958 return visitor(defaultValue);
6959}
6960
6961template <class TYPES>
6962template <class RET_TYPE, class VISITOR>
6963inline
6964RET_TYPE VariantImp<TYPES>::applyRaw(VISITOR& visitor)
6965{
6966 typedef Variant_RawVisitorHelper<RET_TYPE, VISITOR> Helper;
6967
6968 return doApplyR<const Helper&, RET_TYPE>(Helper(&visitor), this->d_type);
6969}
6970
6971template <class TYPES>
6972template <class RET_TYPE, class VISITOR>
6973inline
6974RET_TYPE VariantImp<TYPES>::applyRaw(const VISITOR& visitor)
6975{
6976 typedef Variant_RawVisitorHelper<RET_TYPE, const VISITOR> Helper;
6977
6978 return doApplyR<const Helper&, RET_TYPE>(Helper(&visitor), this->d_type);
6979}
6980
6981template <class TYPES>
6982template <class TYPE>
6983VariantImp<TYPES>& VariantImp<TYPES>::assign(const TYPE& value)
6984{
6985 typedef bsls::ObjectBuffer<TYPE> BufferType;
6986
6987 if (Variant_TypeIndex<TYPES, TYPE>::value == this->d_type) {
6988 reinterpret_cast<BufferType *>(&this->d_value)->object() = value;
6989 }
6990 else {
6991 assignImp<TYPE, TYPE>(value);
6992 }
6993
6994 return *this;
6995}
6996
6997template <class TYPES>
6998template <class TYPE>
6999#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
7000VariantImp<TYPES>& VariantImp<TYPES>::assign(TYPE&& value)
7001#else
7002VariantImp<TYPES>& VariantImp<TYPES>::assign(bslmf::MovableRef<TYPE> value)
7003#endif
7004{
7006 BufferType;
7007
7008#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
7009 if (Variant_TypeIndex<TYPES,
7010 typename bsl::remove_reference<TYPE>::type>::value
7011 == this->d_type) {
7012 reinterpret_cast<BufferType *>(&this->d_value)->object() =
7013 BSLS_COMPILERFEATURES_FORWARD(TYPE, value);
7014 }
7015 else {
7016 assignImp<TYPE>(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
7017 }
7018#else
7019 TYPE& lvalue = value;
7020
7021 if (Variant_TypeIndex<TYPES, TYPE>::value == this->d_type) {
7022 reinterpret_cast<BufferType *>(&this->d_value)->object() =
7023 MoveUtil::move(lvalue);
7024 }
7025 else {
7026 assignImp<TYPE>(MoveUtil::move(lvalue));
7027 }
7028#endif
7029
7030 return *this;
7031}
7032
7033template <class TYPES>
7034template <class TYPE, class SOURCE_TYPE>
7035VariantImp<TYPES>& VariantImp<TYPES>::assignTo(const SOURCE_TYPE& value)
7036{
7037 typedef bsls::ObjectBuffer<TYPE> BufferType;
7038
7039 if (Variant_TypeIndex<TYPES, TYPE>::value == this->d_type
7041 reinterpret_cast<BufferType *>(&this->d_value)->object() = value;
7042 }
7043 else {
7044 assignImp<TYPE, SOURCE_TYPE>(value);
7045 }
7046
7047 return *this;
7048}
7049
7050#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
7051// {{{ BEGIN GENERATED CODE
7052// Command line: sim_cpp11_features.pl bdlb_variant.h
7053#ifndef BDLB_VARIANT_VARIADIC_LIMIT
7054#define BDLB_VARIANT_VARIADIC_LIMIT 14
7055#endif
7056#ifndef BDLB_VARIANT_VARIADIC_LIMIT_B
7057#define BDLB_VARIANT_VARIADIC_LIMIT_B BDLB_VARIANT_VARIADIC_LIMIT
7058#endif
7059
7060#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 0
7061template <class TYPES>
7062template <class TYPE>
7063inline
7064TYPE& VariantImp<TYPES>::createInPlace(
7065 )
7066{
7067 typedef bsls::ObjectBuffer<TYPE> BufferType;
7068 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7069
7070 reset();
7072 bufR.address(),
7073 this->getAllocator());
7074 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7075
7076 return bufR.object();
7077}
7078#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 0
7079
7080#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 1
7081template <class TYPES>
7082template <class TYPE, class ARGS_01>
7083inline
7084TYPE& VariantImp<TYPES>::createInPlace(
7085 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01)
7086{
7087 typedef bsls::ObjectBuffer<TYPE> BufferType;
7088 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7089
7090 reset();
7092 bufR.address(),
7093 this->getAllocator(),
7094 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01));
7095 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7096
7097 return bufR.object();
7098}
7099#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 1
7100
7101#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 2
7102template <class TYPES>
7103template <class TYPE, class ARGS_01,
7104 class ARGS_02>
7105inline
7106TYPE& VariantImp<TYPES>::createInPlace(
7107 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7108 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02)
7109{
7110 typedef bsls::ObjectBuffer<TYPE> BufferType;
7111 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7112
7113 reset();
7115 bufR.address(),
7116 this->getAllocator(),
7117 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7118 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02));
7119 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7120
7121 return bufR.object();
7122}
7123#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 2
7124
7125#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 3
7126template <class TYPES>
7127template <class TYPE, class ARGS_01,
7128 class ARGS_02,
7129 class ARGS_03>
7130inline
7131TYPE& VariantImp<TYPES>::createInPlace(
7132 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7133 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7134 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03)
7135{
7136 typedef bsls::ObjectBuffer<TYPE> BufferType;
7137 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7138
7139 reset();
7141 bufR.address(),
7142 this->getAllocator(),
7143 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7144 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7145 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03));
7146 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7147
7148 return bufR.object();
7149}
7150#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 3
7151
7152#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 4
7153template <class TYPES>
7154template <class TYPE, class ARGS_01,
7155 class ARGS_02,
7156 class ARGS_03,
7157 class ARGS_04>
7158inline
7159TYPE& VariantImp<TYPES>::createInPlace(
7160 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7161 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7162 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7163 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04)
7164{
7165 typedef bsls::ObjectBuffer<TYPE> BufferType;
7166 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7167
7168 reset();
7170 bufR.address(),
7171 this->getAllocator(),
7172 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7173 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7174 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7175 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04));
7176 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7177
7178 return bufR.object();
7179}
7180#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 4
7181
7182#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 5
7183template <class TYPES>
7184template <class TYPE, class ARGS_01,
7185 class ARGS_02,
7186 class ARGS_03,
7187 class ARGS_04,
7188 class ARGS_05>
7189inline
7190TYPE& VariantImp<TYPES>::createInPlace(
7191 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7192 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7193 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7194 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7195 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05)
7196{
7197 typedef bsls::ObjectBuffer<TYPE> BufferType;
7198 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7199
7200 reset();
7202 bufR.address(),
7203 this->getAllocator(),
7204 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7205 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7206 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7207 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7208 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05));
7209 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7210
7211 return bufR.object();
7212}
7213#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 5
7214
7215#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 6
7216template <class TYPES>
7217template <class TYPE, class ARGS_01,
7218 class ARGS_02,
7219 class ARGS_03,
7220 class ARGS_04,
7221 class ARGS_05,
7222 class ARGS_06>
7223inline
7224TYPE& VariantImp<TYPES>::createInPlace(
7225 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7226 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7227 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7228 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7229 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7230 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06)
7231{
7232 typedef bsls::ObjectBuffer<TYPE> BufferType;
7233 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7234
7235 reset();
7237 bufR.address(),
7238 this->getAllocator(),
7239 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7240 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7241 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7242 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7243 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7244 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06));
7245 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7246
7247 return bufR.object();
7248}
7249#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 6
7250
7251#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 7
7252template <class TYPES>
7253template <class TYPE, class ARGS_01,
7254 class ARGS_02,
7255 class ARGS_03,
7256 class ARGS_04,
7257 class ARGS_05,
7258 class ARGS_06,
7259 class ARGS_07>
7260inline
7261TYPE& VariantImp<TYPES>::createInPlace(
7262 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7263 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7264 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7265 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7266 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7267 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7268 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07)
7269{
7270 typedef bsls::ObjectBuffer<TYPE> BufferType;
7271 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7272
7273 reset();
7275 bufR.address(),
7276 this->getAllocator(),
7277 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7278 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7279 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7280 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7281 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7282 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7283 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07));
7284 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7285
7286 return bufR.object();
7287}
7288#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 7
7289
7290#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 8
7291template <class TYPES>
7292template <class TYPE, class ARGS_01,
7293 class ARGS_02,
7294 class ARGS_03,
7295 class ARGS_04,
7296 class ARGS_05,
7297 class ARGS_06,
7298 class ARGS_07,
7299 class ARGS_08>
7300inline
7301TYPE& VariantImp<TYPES>::createInPlace(
7302 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7303 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7304 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7305 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7306 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7307 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7308 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7309 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08)
7310{
7311 typedef bsls::ObjectBuffer<TYPE> BufferType;
7312 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7313
7314 reset();
7316 bufR.address(),
7317 this->getAllocator(),
7318 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7319 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7320 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7321 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7322 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7323 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7324 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7325 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08));
7326 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7327
7328 return bufR.object();
7329}
7330#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 8
7331
7332#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 9
7333template <class TYPES>
7334template <class TYPE, class ARGS_01,
7335 class ARGS_02,
7336 class ARGS_03,
7337 class ARGS_04,
7338 class ARGS_05,
7339 class ARGS_06,
7340 class ARGS_07,
7341 class ARGS_08,
7342 class ARGS_09>
7343inline
7344TYPE& VariantImp<TYPES>::createInPlace(
7345 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7346 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7347 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7348 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7349 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7350 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7351 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7352 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
7353 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09)
7354{
7355 typedef bsls::ObjectBuffer<TYPE> BufferType;
7356 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7357
7358 reset();
7360 bufR.address(),
7361 this->getAllocator(),
7362 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7363 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7364 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7365 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7366 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7367 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7368 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7369 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08),
7370 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, arguments_09));
7371 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7372
7373 return bufR.object();
7374}
7375#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 9
7376
7377#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 10
7378template <class TYPES>
7379template <class TYPE, class ARGS_01,
7380 class ARGS_02,
7381 class ARGS_03,
7382 class ARGS_04,
7383 class ARGS_05,
7384 class ARGS_06,
7385 class ARGS_07,
7386 class ARGS_08,
7387 class ARGS_09,
7388 class ARGS_10>
7389inline
7390TYPE& VariantImp<TYPES>::createInPlace(
7391 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7392 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7393 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7394 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7395 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7396 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7397 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7398 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
7399 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
7400 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10)
7401{
7402 typedef bsls::ObjectBuffer<TYPE> BufferType;
7403 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7404
7405 reset();
7407 bufR.address(),
7408 this->getAllocator(),
7409 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7410 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7411 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7412 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7413 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7414 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7415 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7416 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08),
7417 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, arguments_09),
7418 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, arguments_10));
7419 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7420
7421 return bufR.object();
7422}
7423#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 10
7424
7425#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 11
7426template <class TYPES>
7427template <class TYPE, class ARGS_01,
7428 class ARGS_02,
7429 class ARGS_03,
7430 class ARGS_04,
7431 class ARGS_05,
7432 class ARGS_06,
7433 class ARGS_07,
7434 class ARGS_08,
7435 class ARGS_09,
7436 class ARGS_10,
7437 class ARGS_11>
7438inline
7439TYPE& VariantImp<TYPES>::createInPlace(
7440 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7441 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7442 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7443 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7444 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7445 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7446 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7447 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
7448 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
7449 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
7450 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11)
7451{
7452 typedef bsls::ObjectBuffer<TYPE> BufferType;
7453 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7454
7455 reset();
7457 bufR.address(),
7458 this->getAllocator(),
7459 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7460 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7461 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7462 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7463 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7464 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7465 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7466 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08),
7467 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, arguments_09),
7468 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, arguments_10),
7469 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, arguments_11));
7470 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7471
7472 return bufR.object();
7473}
7474#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 11
7475
7476#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 12
7477template <class TYPES>
7478template <class TYPE, class ARGS_01,
7479 class ARGS_02,
7480 class ARGS_03,
7481 class ARGS_04,
7482 class ARGS_05,
7483 class ARGS_06,
7484 class ARGS_07,
7485 class ARGS_08,
7486 class ARGS_09,
7487 class ARGS_10,
7488 class ARGS_11,
7489 class ARGS_12>
7490inline
7491TYPE& VariantImp<TYPES>::createInPlace(
7492 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7493 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7494 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7495 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7496 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7497 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7498 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7499 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
7500 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
7501 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
7502 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11,
7503 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) arguments_12)
7504{
7505 typedef bsls::ObjectBuffer<TYPE> BufferType;
7506 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7507
7508 reset();
7510 bufR.address(),
7511 this->getAllocator(),
7512 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7513 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7514 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7515 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7516 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7517 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7518 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7519 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08),
7520 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, arguments_09),
7521 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, arguments_10),
7522 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, arguments_11),
7523 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, arguments_12));
7524 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7525
7526 return bufR.object();
7527}
7528#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 12
7529
7530#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 13
7531template <class TYPES>
7532template <class TYPE, class ARGS_01,
7533 class ARGS_02,
7534 class ARGS_03,
7535 class ARGS_04,
7536 class ARGS_05,
7537 class ARGS_06,
7538 class ARGS_07,
7539 class ARGS_08,
7540 class ARGS_09,
7541 class ARGS_10,
7542 class ARGS_11,
7543 class ARGS_12,
7544 class ARGS_13>
7545inline
7546TYPE& VariantImp<TYPES>::createInPlace(
7547 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7548 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7549 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7550 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7551 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7552 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7553 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7554 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
7555 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
7556 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
7557 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11,
7558 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) arguments_12,
7559 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) arguments_13)
7560{
7561 typedef bsls::ObjectBuffer<TYPE> BufferType;
7562 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7563
7564 reset();
7566 bufR.address(),
7567 this->getAllocator(),
7568 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7569 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7570 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7571 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7572 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7573 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7574 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7575 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08),
7576 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, arguments_09),
7577 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, arguments_10),
7578 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, arguments_11),
7579 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, arguments_12),
7580 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, arguments_13));
7581 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7582
7583 return bufR.object();
7584}
7585#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 13
7586
7587#if BDLB_VARIANT_VARIADIC_LIMIT_B >= 14
7588template <class TYPES>
7589template <class TYPE, class ARGS_01,
7590 class ARGS_02,
7591 class ARGS_03,
7592 class ARGS_04,
7593 class ARGS_05,
7594 class ARGS_06,
7595 class ARGS_07,
7596 class ARGS_08,
7597 class ARGS_09,
7598 class ARGS_10,
7599 class ARGS_11,
7600 class ARGS_12,
7601 class ARGS_13,
7602 class ARGS_14>
7603inline
7604TYPE& VariantImp<TYPES>::createInPlace(
7605 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) arguments_01,
7606 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) arguments_02,
7607 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) arguments_03,
7608 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) arguments_04,
7609 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) arguments_05,
7610 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) arguments_06,
7611 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) arguments_07,
7612 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) arguments_08,
7613 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) arguments_09,
7614 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) arguments_10,
7615 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) arguments_11,
7616 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) arguments_12,
7617 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) arguments_13,
7618 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) arguments_14)
7619{
7620 typedef bsls::ObjectBuffer<TYPE> BufferType;
7621 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7622
7623 reset();
7625 bufR.address(),
7626 this->getAllocator(),
7627 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, arguments_01),
7628 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, arguments_02),
7629 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, arguments_03),
7630 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, arguments_04),
7631 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, arguments_05),
7632 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, arguments_06),
7633 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, arguments_07),
7634 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, arguments_08),
7635 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, arguments_09),
7636 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, arguments_10),
7637 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, arguments_11),
7638 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, arguments_12),
7639 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, arguments_13),
7640 BSLS_COMPILERFEATURES_FORWARD(ARGS_14, arguments_14));
7641 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7642
7643 return bufR.object();
7644}
7645#endif // BDLB_VARIANT_VARIADIC_LIMIT_B >= 14
7646
7647#else
7648// The generated code below is a workaround for the absence of perfect
7649// forwarding in some compilers.
7650
7651template <class TYPES>
7652template <class TYPE, class... ARGS>
7653inline
7654TYPE& VariantImp<TYPES>::createInPlace(
7655 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... arguments)
7656{
7657 typedef bsls::ObjectBuffer<TYPE> BufferType;
7658 BufferType& bufR = *reinterpret_cast<BufferType *>(&this->d_value);
7659
7660 reset();
7662 bufR.address(),
7663 this->getAllocator(),
7664 BSLS_COMPILERFEATURES_FORWARD(ARGS, arguments)...);
7665 this->d_type = Variant_TypeIndex<TYPES, TYPE>::value;
7666
7667 return bufR.object();
7668}
7669
7670// }}} END GENERATED CODE
7671#endif
7672
7673template <class TYPES>
7674void VariantImp<TYPES>::reset()
7675{
7676 if (this->d_type) {
7677 Variant_DestructorVisitor destructor;
7678 apply(destructor);
7679 this->d_type = 0;
7680 }
7681}
7682
7683template <class TYPES>
7684void VariantImp<TYPES>::swap(VariantImp<TYPES>& other)
7685{
7686 if (!this->d_type) {
7687 if (!other.d_type) {
7688 return; // RETURN
7689 }
7690 *this = other;
7691 other.reset();
7692 }
7693 else if (!other.d_type) {
7694 other = *this;
7695 this->reset();
7696 }
7697 else {
7698 if (this->d_type == other.d_type
7699 && this->getAllocator() == other.getAllocator()) {
7700 // Same types and same allocators, so use a visitor that calls
7701 // 'swap'.
7702
7703 Variant_SwapVisitor swapper(&this->d_value);
7704 other.apply(swapper);
7705 }
7706 else {
7707 // Different types and/or allocators, so swap via assignment. Note
7708 // that this doesn't fit the usual pattern for calling 'swap'
7709 // because infinite recursion would result.
7710
7711 bsl::swap(*this, other);
7712 }
7713 }
7714}
7715
7716template <class TYPES>
7717template <class TYPE>
7718inline
7719TYPE& VariantImp<TYPES>::the()
7720{
7721 BSLMF_ASSERT((0 != Variant_TypeIndex<TYPES, TYPE>::value));
7722 BSLS_ASSERT_SAFE((this->d_type == Variant_TypeIndex<TYPES, TYPE>::value));
7723
7724 typedef bsls::ObjectBuffer<TYPE> BufferType;
7725
7726 return reinterpret_cast<BufferType *>(&this->d_value)->object();
7727}
7728
7729// ACCESSORS
7730template <class TYPES>
7731template <class RET_TYPE, class VISITOR>
7732inline
7733RET_TYPE VariantImp<TYPES>::apply(VISITOR& visitor) const
7734{
7735 if (this->d_type) {
7736 return doApplyR<VISITOR&, RET_TYPE>(visitor, this->d_type); // RETURN
7737 }
7738
7739 bslmf::Nil nil = bslmf::Nil();
7740 return visitor(nil);
7741}
7742
7743template <class TYPES>
7744template <class RET_TYPE, class VISITOR>
7745inline
7746RET_TYPE VariantImp<TYPES>::apply(const VISITOR& visitor) const
7747{
7748 if (this->d_type) {
7749 return doApplyR<const VISITOR&, RET_TYPE>(visitor, this->d_type);
7750 // RETURN
7751 }
7752
7753 bslmf::Nil nil = bslmf::Nil();
7754 return visitor(nil);
7755}
7756
7757template <class TYPES>
7758template <class RET_TYPE, class VISITOR, class TYPE>
7759inline
7760RET_TYPE VariantImp<TYPES>::apply(VISITOR& visitor,
7761 const TYPE& defaultValue) const
7762{
7763 if (this->d_type) {
7764 return doApplyR<VISITOR&, RET_TYPE>(visitor, this->d_type); // RETURN
7765 }
7766
7767 return visitor(defaultValue);
7768}
7769
7770template <class TYPES>
7771template <class RET_TYPE, class VISITOR, class TYPE>
7772inline
7773RET_TYPE VariantImp<TYPES>::apply(const VISITOR& visitor,
7774 const TYPE& defaultValue) const
7775{
7776 if (this->d_type) {
7777 return doApplyR<const VISITOR&, RET_TYPE>(visitor, this->d_type);
7778 // RETURN
7779 }
7780
7781 return visitor(defaultValue);
7782}
7783
7784template <class TYPES>
7785template <class RET_TYPE, class VISITOR>
7786inline
7787RET_TYPE VariantImp<TYPES>::applyRaw(VISITOR& visitor) const
7788{
7789 typedef Variant_RawVisitorHelper<RET_TYPE, VISITOR> Helper;
7790
7791 return doApplyR<const Helper&, RET_TYPE>(Helper(&visitor), this->d_type);
7792}
7793
7794template <class TYPES>
7795template <class RET_TYPE, class VISITOR>
7796inline
7797RET_TYPE VariantImp<TYPES>::applyRaw(const VISITOR& visitor) const
7798{
7799 typedef Variant_RawVisitorHelper<RET_TYPE, const VISITOR> Helper;
7800
7801 return doApplyR<const Helper&, RET_TYPE>(Helper(&visitor), this->d_type);
7802}
7803
7804template <class TYPES>
7805template <class TYPE>
7806inline
7807bool VariantImp<TYPES>::is() const
7808{
7809 return Variant_TypeIndex<TYPES, TYPE>::value == this->d_type;
7810}
7811
7812template <class TYPES>
7813inline
7814bool VariantImp<TYPES>::isUnset() const
7815{
7816 return !this->d_type;
7817}
7818
7819template <class TYPES>
7820bsl::ostream&
7821VariantImp<TYPES>::print(bsl::ostream& stream,
7822 int level,
7823 int spacesPerLevel) const
7824{
7825 if (this->d_type) {
7826 Variant_PrintVisitor visitor(&stream, level, spacesPerLevel);
7827
7828 doApply<const Variant_PrintVisitor&>(visitor, this->d_type);
7829 }
7830 return stream;
7831}
7832
7833template <class TYPES>
7834template <class TYPE>
7835inline
7836const TYPE& VariantImp<TYPES>::the() const
7837{
7838 BSLMF_ASSERT((0 != Variant_TypeIndex<TYPES, TYPE>::value));
7839 BSLS_ASSERT_SAFE((this->d_type == Variant_TypeIndex<TYPES, TYPE>::value));
7840
7841 typedef bsls::ObjectBuffer<TYPE> BufferType;
7842
7843 return reinterpret_cast<const BufferType *>(&this->d_value)->object();
7844}
7845
7846template <class TYPES>
7847inline
7848int VariantImp<TYPES>::typeIndex() const
7849{
7850 return this->d_type;
7851}
7852
7853#ifndef BDE_OMIT_INTERNAL_DEPRECATED
7854template <class TYPES>
7855inline
7856const bsl::type_info& VariantImp<TYPES>::typeInfo() const
7857{
7858 return typeid(void);
7859}
7860
7861template <class TYPES>
7862template <class STREAM>
7863STREAM& VariantImp<TYPES>::bdexStreamIn(STREAM& stream, int version)
7864{
7865 int type;
7867
7868 if (!stream || type < 0 || 20 < type) {
7869 stream.invalidate();
7870 return stream;
7871 }
7872
7873 if (type != this->d_type) {
7874 reset();
7875
7876 if (type) {
7877 Variant_DefaultConstructVisitor defaultConstructor(
7878 this->getAllocator());
7879 doApply(defaultConstructor, type);
7880 }
7881
7882 this->d_type = type;
7883 }
7884
7885 if (type) {
7886 Variant_BdexStreamInVisitor<STREAM> streamer(stream, version);
7887 doApply(streamer, type);
7888 }
7889 return stream;
7890}
7891
7892template <class TYPES>
7893inline
7894int VariantImp<TYPES>::maxSupportedBdexVersion() const
7895{
7896 return 1;
7897}
7898
7899template <class TYPES>
7900template <class STREAM>
7901STREAM& VariantImp<TYPES>::bdexStreamOut(STREAM& stream, int version) const
7902{
7903 bslx::OutStreamFunctions::bdexStreamOut(stream, this->d_type, 0);
7904
7905 if (this->d_type) {
7906 typedef Variant_BdexStreamOutVisitor<STREAM> Streamer;
7907
7908 Streamer streamer(stream, version);
7909 doApply<Streamer&>(streamer, this->d_type);
7910 }
7911 return stream;
7912}
7913
7914#endif // BDE_OMIT_INTERNAL_DEPRECATED
7915
7916} // close package namespace
7917
7918// FREE OPERATORS
7919template <class TYPES>
7920bool bdlb::operator==(const VariantImp<TYPES>& lhs,
7921 const VariantImp<TYPES>& rhs)
7922{
7923 if (lhs.typeIndex() != rhs.typeIndex()) {
7924 return false; // RETURN
7925 }
7926
7927 if (0 == lhs.typeIndex()) {
7928 return true; // RETURN
7929 }
7930
7931 Variant_EqualityTestVisitor visitor(&rhs.d_value);
7932 lhs.apply(visitor);
7933
7934 return visitor.d_result;
7935}
7936
7937template <class TYPES>
7938inline
7939bool bdlb::operator!=(const VariantImp<TYPES>& lhs,
7940 const VariantImp<TYPES>& rhs)
7941{
7942 return !(lhs == rhs);
7943}
7944
7945template <class TYPES>
7946inline
7947bsl::ostream& bdlb::operator<<(bsl::ostream& stream,
7948 const VariantImp<TYPES>& object)
7949{
7950 return object.print(stream, 0, -1);
7951}
7952
7953// FREE FUNCTIONS
7954template <class TYPES>
7955inline
7956void bdlb::swap(VariantImp<TYPES>& a, VariantImp<TYPES>& b)
7957{
7958 a.swap(b);
7959}
7960
7961namespace bdlb {
7962
7963 // ------------------
7964 // class Variant<...>
7965 // ------------------
7966
7967// CREATORS
7968#if defined(BDLB_VARIANT_USING_VARIADIC_TEMPLATES)
7969template <class ...TYPES>
7970inline
7972{
7973}
7974
7975template <class ...TYPES>
7976template <class TYPE_OR_ALLOCATOR>
7977inline
7978Variant<TYPES...>::Variant(const TYPE_OR_ALLOCATOR& valueOrAllocator)
7979: Imp(valueOrAllocator)
7980{
7981}
7982
7983template <class ...TYPES>
7984template <class TYPE>
7985inline
7986Variant<TYPES...>::Variant(const TYPE& value, bslma::Allocator *basicAllocator)
7987: Imp(value, basicAllocator)
7988{
7989}
7990
7991template <class ...TYPES>
7992template <class TYPE>
7993inline
7994Variant<TYPES...>::
7995#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
7996Variant(TYPE&& value,
7997 typename bsl::enable_if<
7998 !bsl::is_same<
7999 SelfType,
8000 typename bsl::remove_const<
8001 typename bsl::remove_reference<TYPE>::type>::type>::value
8002 &&
8004 void>::type *)
8005: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8006#else
8007Variant(bslmf::MovableRef<TYPE> value)
8008: Imp(MoveUtil::move(value))
8009#endif
8010{
8011}
8012
8013template <class ...TYPES>
8014template <class TYPE>
8015inline
8016Variant<TYPES...>::
8017#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8018Variant(TYPE&& value,
8019 typename bsl::enable_if<
8020 !bsl::is_same<
8021 SelfType,
8022 typename bsl::remove_const<
8023 typename bsl::remove_reference<TYPE>::type>::type>::value,
8024 bslma::Allocator>::type *basicAllocator)
8025: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
8026#else
8027Variant(bslmf::MovableRef<TYPE> value,
8028 bslma::Allocator *basicAllocator)
8029: Imp(MoveUtil::move(value), basicAllocator)
8030#endif
8031{
8032}
8033
8034/// Up-cast needed since template matching has higher overloading precedence
8035/// than derived-to-base matching.
8036template <class ...TYPES>
8037inline
8038Variant<TYPES...>::Variant(const Variant& original,
8039 bslma::Allocator *basicAllocator)
8040: Imp(static_cast<const Imp&>(original), basicAllocator)
8041{
8042}
8043
8044template <class ...TYPES>
8045inline
8046Variant<TYPES...>::Variant(bslmf::MovableRef<Variant> original)
8047: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
8048{
8049}
8050
8051template <class ...TYPES>
8052inline
8053Variant<TYPES...>::Variant(bslmf::MovableRef<Variant> original,
8054 bslma::Allocator *basicAllocator)
8055: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
8056 basicAllocator)
8057{
8058}
8059
8060// MANIPULATORS
8061template <class ...TYPES>
8062template <class TYPE>
8063inline
8064Variant<TYPES...>& Variant<TYPES...>::operator=(const TYPE& value)
8065{
8066 Imp::operator=(value);
8067 return *this;
8068}
8069
8070template <class ...TYPES>
8071template <class TYPE>
8072inline
8073#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8074typename bsl::enable_if<
8075 !bsl::is_same<Variant<TYPES...>,
8076 typename bsl::remove_cvref<TYPE>::type>::value,
8077Variant<TYPES...> >::type&
8078Variant<TYPES...>::operator=(TYPE&& value)
8079#else
8080Variant<TYPES...>&
8081Variant<TYPES...>::operator=(bslmf::MovableRef<TYPE> value)
8082#endif
8083{
8084#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8085 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
8086#else
8087 TYPE& lvalue = value;
8088 Imp::operator=(MoveUtil::move(lvalue));
8089#endif
8090
8091 return *this;
8092}
8093
8094template <class ...TYPES>
8095inline
8096Variant<TYPES...>& Variant<TYPES...>::operator=(const Variant& rhs)
8097{
8098 // Up-cast needed since template matching has higher overloading precedence
8099 // than derived-to-base matching.
8100
8101 Imp::operator=(static_cast<const Imp&>(rhs));
8102 return *this;
8103}
8104
8105template <class ...TYPES>
8106inline
8107Variant<TYPES...>& Variant<TYPES...>::operator=(bslmf::MovableRef<Variant> rhs)
8108{
8109 // Up-cast needed since template matching has higher overloading precedence
8110 // than derived-to-base matching.
8111
8112 Variant& lvalue = rhs;
8113
8114 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
8115 return *this;
8116}
8117
8118#else // BDLB_VARIANT_USING_VARIADIC_TEMPLATES
8119template <class A1, class A2, class A3, class A4, class A5, class A6,
8120 class A7, class A8, class A9, class A10, class A11, class A12,
8121 class A13, class A14, class A15, class A16, class A17, class A18,
8122 class A19, class A20>
8123inline
8124Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8125 A13, A14, A15, A16, A17, A18, A19, A20>::Variant()
8126{
8127}
8128
8129template <class A1, class A2, class A3, class A4, class A5, class A6,
8130 class A7, class A8, class A9, class A10, class A11, class A12,
8131 class A13, class A14, class A15, class A16, class A17, class A18,
8132 class A19, class A20>
8133template <class TYPE_OR_ALLOCATOR>
8134inline
8135Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8136 A13, A14, A15, A16, A17, A18, A19, A20>::Variant(
8137 const TYPE_OR_ALLOCATOR& valueOrAllocator)
8138: Imp(valueOrAllocator)
8139{
8140}
8141
8142template <class A1, class A2, class A3, class A4, class A5, class A6,
8143 class A7, class A8, class A9, class A10, class A11, class A12,
8144 class A13, class A14, class A15, class A16, class A17, class A18,
8145 class A19, class A20>
8146template <class TYPE>
8147inline
8148Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8149 A13, A14, A15, A16, A17, A18, A19, A20>::Variant(
8150 const TYPE& value,
8151 bslma::Allocator *basicAllocator)
8152: Imp(value, basicAllocator)
8153{
8154}
8155
8156template <class A1, class A2, class A3, class A4, class A5, class A6,
8157 class A7, class A8, class A9, class A10, class A11, class A12,
8158 class A13, class A14, class A15, class A16, class A17, class A18,
8159 class A19, class A20>
8160template <class TYPE>
8161inline
8162Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8163 A13, A14, A15, A16, A17, A18, A19, A20>::
8164#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8165Variant(TYPE&& value,
8166 typename bsl::enable_if<
8167 !bsl::is_same<
8168 SelfType,
8169 typename bsl::remove_const<
8170 typename bsl::remove_reference<TYPE>::type>::type>::value
8171 &&
8173 void>::type *)
8174: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8175#else
8176Variant(bslmf::MovableRef<TYPE> value)
8177: Imp(MoveUtil::move(value))
8178#endif
8179{
8180}
8181
8182template <class A1, class A2, class A3, class A4, class A5, class A6,
8183 class A7, class A8, class A9, class A10, class A11, class A12,
8184 class A13, class A14, class A15, class A16, class A17, class A18,
8185 class A19, class A20>
8186template <class TYPE>
8187inline
8188Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8189 A13, A14, A15, A16, A17, A18, A19, A20>::
8190#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8191Variant(TYPE&& value,
8192 typename bsl::enable_if<
8193 !bsl::is_same<
8194 SelfType,
8195 typename bsl::remove_const<
8196 typename bsl::remove_reference<TYPE>::type>::type>::value,
8197 bslma::Allocator>::type *basicAllocator)
8198: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
8199#else
8200Variant(bslmf::MovableRef<TYPE> value,
8201 bslma::Allocator *basicAllocator)
8202: Imp(MoveUtil::move(value), basicAllocator)
8203#endif
8204{
8205}
8206
8207template <class A1, class A2, class A3, class A4, class A5, class A6,
8208 class A7, class A8, class A9, class A10, class A11, class A12,
8209 class A13, class A14, class A15, class A16, class A17, class A18,
8210 class A19, class A20>
8211inline
8212Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8213 A13, A14, A15, A16, A17, A18, A19, A20>::Variant(
8214 const Variant& original,
8215 bslma::Allocator *basicAllocator)
8216: Imp(static_cast<const Imp&>(original), basicAllocator)
8217 // Up-cast needed since template matching has higher overloading precedence
8218 // than derived-to-base matching.
8219{
8220}
8221
8222template <class A1, class A2, class A3, class A4, class A5, class A6,
8223 class A7, class A8, class A9, class A10, class A11, class A12,
8224 class A13, class A14, class A15, class A16, class A17, class A18,
8225 class A19, class A20>
8226inline
8227Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8228 A13, A14, A15, A16, A17, A18, A19, A20>::Variant(
8230: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
8231{
8232}
8233
8234template <class A1, class A2, class A3, class A4, class A5, class A6,
8235 class A7, class A8, class A9, class A10, class A11, class A12,
8236 class A13, class A14, class A15, class A16, class A17, class A18,
8237 class A19, class A20>
8238inline
8239Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8240 A13, A14, A15, A16, A17, A18, A19, A20>::Variant(
8242 bslma::Allocator *basicAllocator)
8243: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
8244 basicAllocator)
8245{
8246}
8247
8248// MANIPULATORS
8249template <class A1, class A2, class A3, class A4, class A5, class A6,
8250 class A7, class A8, class A9, class A10, class A11, class A12,
8251 class A13, class A14, class A15, class A16, class A17, class A18,
8252 class A19, class A20>
8253template <class TYPE>
8254inline
8255Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8256 A13, A14, A15, A16, A17, A18, A19, A20>&
8257Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8258 A13, A14, A15, A16, A17, A18, A19, A20>::operator=(const TYPE& value)
8259{
8260 Imp::operator=(value);
8261 return *this;
8262}
8263
8264template <class A1, class A2, class A3, class A4, class A5, class A6,
8265 class A7, class A8, class A9, class A10, class A11, class A12,
8266 class A13, class A14, class A15, class A16, class A17, class A18,
8267 class A19, class A20>
8268template <class TYPE>
8269inline
8270#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8271typename bsl::enable_if<
8272 !bsl::is_same<Variant<A1, A2, A3, A4, A5, A6, A7,
8273 A8, A9, A10, A11, A12, A13, A14,
8274 A15, A16, A17, A18, A19, A20>,
8275 typename bsl::remove_cvref<TYPE>::type>::value,
8276Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
8277 A16, A17, A18, A19, A20> >::type&
8278Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
8279 A16, A17, A18, A19, A20>::operator=(TYPE&& value)
8280#else
8281Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
8282 A16, A17, A18, A19, A20>&
8283Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
8284 A16, A17, A18, A19, A20>::operator=(bslmf::MovableRef<TYPE> value)
8285#endif
8286{
8287#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8288 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
8289#else
8290 TYPE& lvalue = value;
8291 Imp::operator=(MoveUtil::move(lvalue));
8292#endif
8293
8294 return *this;
8295}
8296
8297template <class A1, class A2, class A3, class A4, class A5, class A6,
8298 class A7, class A8, class A9, class A10, class A11, class A12,
8299 class A13, class A14, class A15, class A16, class A17, class A18,
8300 class A19, class A20>
8301inline
8302Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8303 A13, A14, A15, A16, A17, A18, A19, A20>&
8304Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8305 A13, A14, A15, A16, A17, A18, A19, A20>::operator=(const Variant& rhs)
8306{
8307 // Up-cast needed since template matching has higher overloading precedence
8308 // than derived-to-base matching.
8309
8310 Imp::operator=(static_cast<const Imp&>(rhs));
8311 return *this;
8312}
8313
8314template <class A1, class A2, class A3, class A4, class A5, class A6,
8315 class A7, class A8, class A9, class A10, class A11, class A12,
8316 class A13, class A14, class A15, class A16, class A17, class A18,
8317 class A19, class A20>
8318inline
8319Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8320 A13, A14, A15, A16, A17, A18, A19, A20>&
8321Variant<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
8322 A13, A14, A15, A16, A17, A18, A19, A20>::
8323operator=(bslmf::MovableRef<Variant> rhs)
8324{
8325 // Up-cast needed since template matching has higher overloading precedence
8326 // than derived-to-base matching.
8327
8328 Variant& lvalue = rhs;
8329
8330 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
8331 return *this;
8332}
8333
8334#endif // BDLB_VARIANT_USING_VARIADIC_TEMPLATES
8335
8336#ifdef BDLB_VARIANT_USING_VARIADIC_TEMPLATES
8337#undef BDLB_VARIANT_USING_VARIADIC_TEMPLATES
8338#endif
8339
8340 // -------------------
8341 // class Variant2<...>
8342 // -------------------
8343
8344// CREATORS
8345template <class A1, class A2>
8346inline
8347Variant2<A1, A2>::Variant2()
8348{
8349}
8350
8351template <class A1, class A2>
8352template <class TYPE_OR_ALLOCATOR>
8353inline
8354Variant2<A1, A2>::Variant2(const TYPE_OR_ALLOCATOR& valueOrAllocator)
8355: Imp(valueOrAllocator)
8356{
8357}
8358
8359template <class A1, class A2>
8360template <class TYPE>
8361inline
8362Variant2<A1, A2>::Variant2(const TYPE& value,
8363 bslma::Allocator *basicAllocator)
8364: Imp(value, basicAllocator)
8365{
8366}
8367
8368template <class A1, class A2>
8369template <class TYPE>
8370inline
8371Variant2<A1, A2>::
8372#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8373Variant2(TYPE&& value,
8374 typename bsl::enable_if<
8375 !bsl::is_same<
8376 SelfType,
8377 typename bsl::remove_const<
8378 typename bsl::remove_reference<TYPE>::type>::type>::value
8379 &&
8381 void>::type *)
8382: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8383#else
8384Variant2(bslmf::MovableRef<TYPE> value)
8385: Imp(MoveUtil::move(value))
8386#endif
8387{
8388}
8389
8390template <class A1, class A2>
8391template <class TYPE>
8392inline
8393Variant2<A1, A2>::
8394#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8395Variant2(TYPE&& value,
8396 typename bsl::enable_if<
8397 !bsl::is_same<
8398 SelfType,
8399 typename bsl::remove_const<
8400 typename bsl::remove_reference<TYPE>::type>::type>::value,
8401 bslma::Allocator>::type *basicAllocator)
8402: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
8403#else
8404Variant2(bslmf::MovableRef<TYPE> value,
8405 bslma::Allocator *basicAllocator)
8406: Imp(MoveUtil::move(value), basicAllocator)
8407#endif
8408{
8409}
8410
8411template <class A1, class A2>
8412inline
8413Variant2<A1, A2>::Variant2(const Variant2& original,
8414 bslma::Allocator *basicAllocator)
8415: Imp(static_cast<const Imp&>(original), basicAllocator)
8416{
8417}
8418
8419template <class A1, class A2>
8420inline
8421Variant2<A1, A2>::Variant2(bslmf::MovableRef<Variant2> original)
8422: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
8423{
8424}
8425
8426template <class A1, class A2>
8427inline
8428Variant2<A1, A2>::Variant2(bslmf::MovableRef<Variant2> original,
8429 bslma::Allocator *basicAllocator)
8430: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
8431 basicAllocator)
8432{
8433}
8434
8435// MANIPULATORS
8436template <class A1, class A2>
8437template <class TYPE>
8438inline
8439Variant2<A1, A2>&
8440Variant2<A1, A2>::operator=(const TYPE& value)
8441{
8442 Imp::operator=(value);
8443 return *this;
8444}
8445
8446template <class A1, class A2>
8447template <class TYPE>
8448inline
8449#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8450typename bsl::enable_if<
8452 typename bsl::remove_cvref<TYPE>::type>::value,
8453Variant2<A1, A2> >::type&
8454Variant2<A1, A2>::operator=(TYPE&& value)
8455#else
8456Variant2<A1, A2>&
8457Variant2<A1, A2>::operator=(bslmf::MovableRef<TYPE> value)
8458#endif
8459{
8460#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8461 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
8462#else
8463 TYPE& lvalue = value;
8464 Imp::operator=(MoveUtil::move(lvalue));
8465#endif
8466
8467 return *this;
8468}
8469
8470template <class A1, class A2>
8471inline
8472Variant2<A1, A2>&
8473Variant2<A1, A2>::operator=(const Variant2& rhs)
8474{
8475 Imp::operator=(static_cast<const Imp&>(rhs));
8476 return *this;
8477}
8478
8479template <class A1, class A2>
8480inline
8481Variant2<A1, A2>&
8482Variant2<A1, A2>::operator=(bslmf::MovableRef<Variant2> rhs)
8483{
8484 Variant2& lvalue = rhs;
8485
8486 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
8487 return *this;
8488}
8489
8490 // -------------------
8491 // class Variant3<...>
8492 // -------------------
8493
8494// CREATORS
8495template <class A1, class A2, class A3>
8496inline
8497Variant3<A1, A2, A3>::Variant3()
8498{
8499}
8500
8501template <class A1, class A2, class A3>
8502template <class TYPE_OR_ALLOCATOR>
8503inline
8504Variant3<A1, A2, A3>::
8505Variant3(const TYPE_OR_ALLOCATOR& valueOrAllocator)
8506: Imp(valueOrAllocator)
8507{
8508}
8509
8510template <class A1, class A2, class A3>
8511template <class TYPE>
8512inline
8513Variant3<A1, A2, A3>::
8514Variant3(const TYPE& value, bslma::Allocator *basicAllocator)
8515: Imp(value, basicAllocator)
8516{
8517}
8518
8519template <class A1, class A2, class A3>
8520template <class TYPE>
8521inline
8522Variant3<A1, A2, A3>::
8523#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8524Variant3(TYPE&& value,
8525 typename bsl::enable_if<
8526 !bsl::is_same<
8527 SelfType,
8528 typename bsl::remove_const<
8529 typename bsl::remove_reference<TYPE>::type>::type>::value
8530 &&
8532 void>::type *)
8533: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8534#else
8535Variant3(bslmf::MovableRef<TYPE> value)
8536: Imp(MoveUtil::move(value))
8537#endif
8538{
8539}
8540
8541template <class A1, class A2, class A3>
8542template <class TYPE>
8543inline
8544Variant3<A1, A2, A3>::
8545#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8546Variant3(TYPE&& value,
8547 typename bsl::enable_if<
8548 !bsl::is_same<
8549 SelfType,
8550 typename bsl::remove_const<
8551 typename bsl::remove_reference<TYPE>::type>::type>::value,
8552 bslma::Allocator>::type *basicAllocator)
8553: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
8554#else
8555Variant3(bslmf::MovableRef<TYPE> value,
8556 bslma::Allocator *basicAllocator)
8557: Imp(MoveUtil::move(value), basicAllocator)
8558#endif
8559{
8560}
8561
8562template <class A1, class A2, class A3>
8563inline
8564Variant3<A1, A2, A3>::
8565Variant3(const Variant3& original, bslma::Allocator *basicAllocator)
8566: Imp(static_cast<const Imp&>(original), basicAllocator)
8567{
8568}
8569
8570template <class A1, class A2, class A3>
8571inline
8572Variant3<A1, A2, A3>::
8573Variant3(bslmf::MovableRef<Variant3> original)
8574: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
8575{
8576}
8577
8578template <class A1, class A2, class A3>
8579inline
8580Variant3<A1, A2, A3>::
8581Variant3(bslmf::MovableRef<Variant3> original,
8582 bslma::Allocator *basicAllocator)
8583: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
8584 basicAllocator)
8585{
8586}
8587
8588// MANIPULATORS
8589template <class A1, class A2, class A3>
8590template <class TYPE>
8591inline
8592Variant3<A1, A2, A3>&
8593Variant3<A1, A2, A3>::operator=(const TYPE& value)
8594{
8595 Imp::operator=(value);
8596 return *this;
8597}
8598
8599template <class A1, class A2, class A3>
8600template <class TYPE>
8601inline
8602#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8603typename bsl::enable_if<
8605 typename bsl::remove_cvref<TYPE>::type>::value,
8606Variant3<A1, A2, A3> >::type&
8607Variant3<A1, A2, A3>::operator=(TYPE&& value)
8608#else
8609Variant3<A1, A2, A3>&
8610Variant3<A1, A2, A3>::operator=(bslmf::MovableRef<TYPE> value)
8611#endif
8612{
8613#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8614 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
8615#else
8616 TYPE& lvalue = value;
8617 Imp::operator=(MoveUtil::move(lvalue));
8618#endif
8619
8620 return *this;
8621}
8622
8623template <class A1, class A2, class A3>
8624inline
8625Variant3<A1, A2, A3>&
8626Variant3<A1, A2, A3>::operator=(const Variant3& rhs)
8627{
8628 Imp::operator=(static_cast<const Imp&>(rhs));
8629 return *this;
8630}
8631
8632template <class A1, class A2, class A3>
8633inline
8634Variant3<A1, A2, A3>&
8635Variant3<A1, A2, A3>::operator=(bslmf::MovableRef<Variant3> rhs)
8636{
8637 Variant3& lvalue = rhs;
8638
8639 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
8640 return *this;
8641}
8642
8643 // -------------------
8644 // class Variant4<...>
8645 // -------------------
8646
8647// CREATORS
8648template <class A1, class A2, class A3, class A4>
8649inline
8650Variant4<A1, A2, A3, A4>::Variant4()
8651{
8652}
8653
8654template <class A1, class A2, class A3, class A4>
8655template <class TYPE_OR_ALLOCATOR>
8656inline
8657Variant4<A1, A2, A3, A4>::
8658Variant4(const TYPE_OR_ALLOCATOR& valueOrAllocator)
8659: Imp(valueOrAllocator)
8660{
8661}
8662
8663template <class A1, class A2, class A3, class A4>
8664template <class TYPE>
8665inline
8666Variant4<A1, A2, A3, A4>::
8667Variant4(const TYPE& value, bslma::Allocator *basicAllocator)
8668: Imp(value, basicAllocator)
8669{
8670}
8671
8672template <class A1, class A2, class A3, class A4>
8673template <class TYPE>
8674inline
8675Variant4<A1, A2, A3, A4>::
8676#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8677Variant4(TYPE&& value,
8678 typename bsl::enable_if<
8679 !bsl::is_same<
8680 SelfType,
8681 typename bsl::remove_const<
8682 typename bsl::remove_reference<TYPE>::type>::type>::value
8683 &&
8685 void>::type *)
8686: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8687#else
8688Variant4(bslmf::MovableRef<TYPE> value)
8689: Imp(MoveUtil::move(value))
8690#endif
8691{
8692}
8693
8694template <class A1, class A2, class A3, class A4>
8695template <class TYPE>
8696inline
8697Variant4<A1, A2, A3, A4>::
8698#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8699Variant4(TYPE&& value,
8700 typename bsl::enable_if<
8701 !bsl::is_same<
8702 SelfType,
8703 typename bsl::remove_const<
8704 typename bsl::remove_reference<TYPE>::type>::type>::value,
8705 bslma::Allocator>::type *basicAllocator)
8706: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
8707#else
8708Variant4(bslmf::MovableRef<TYPE> value,
8709 bslma::Allocator *basicAllocator)
8710: Imp(MoveUtil::move(value), basicAllocator)
8711#endif
8712{
8713}
8714
8715template <class A1, class A2, class A3, class A4>
8716inline
8717Variant4<A1, A2, A3, A4>::
8718Variant4(const Variant4& original, bslma::Allocator *basicAllocator)
8719: Imp(static_cast<const Imp&>(original), basicAllocator)
8720{
8721}
8722
8723template <class A1, class A2, class A3, class A4>
8724inline
8725Variant4<A1, A2, A3, A4>::
8726Variant4(bslmf::MovableRef<Variant4> original)
8727: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
8728{
8729}
8730
8731template <class A1, class A2, class A3, class A4>
8732inline
8733Variant4<A1, A2, A3, A4>::
8734Variant4(bslmf::MovableRef<Variant4> original,
8735 bslma::Allocator *basicAllocator)
8736: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
8737 basicAllocator)
8738{
8739}
8740
8741// MANIPULATORS
8742template <class A1, class A2, class A3, class A4>
8743template <class TYPE>
8744inline
8745Variant4<A1, A2, A3, A4>&
8746Variant4<A1, A2, A3, A4>::operator=(const TYPE& value)
8747{
8748 Imp::operator=(value);
8749 return *this;
8750}
8751
8752template <class A1, class A2, class A3, class A4>
8753template <class TYPE>
8754inline
8755#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8756typename bsl::enable_if<
8758 typename bsl::remove_cvref<TYPE>::type>::value,
8759Variant4<A1, A2, A3, A4> >::type&
8760Variant4<A1, A2, A3, A4>::operator=(TYPE&& value)
8761#else
8762Variant4<A1, A2, A3, A4>&
8763Variant4<A1, A2, A3, A4>::operator=(bslmf::MovableRef<TYPE> value)
8764#endif
8765{
8766#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8767 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
8768#else
8769 TYPE& lvalue = value;
8770 Imp::operator=(MoveUtil::move(lvalue));
8771#endif
8772
8773 return *this;
8774}
8775
8776template <class A1, class A2, class A3, class A4>
8777inline
8778Variant4<A1, A2, A3, A4>&
8779Variant4<A1, A2, A3, A4>::operator=(const Variant4& rhs)
8780{
8781 Imp::operator=(static_cast<const Imp&>(rhs));
8782 return *this;
8783}
8784
8785template <class A1, class A2, class A3, class A4>
8786inline
8787Variant4<A1, A2, A3, A4>&
8788Variant4<A1, A2, A3, A4>::operator=(bslmf::MovableRef<Variant4> rhs)
8789{
8790 Variant4& lvalue = rhs;
8791
8792 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
8793 return *this;
8794}
8795
8796 // -------------------
8797 // class Variant5<...>
8798 // -------------------
8799
8800// CREATORS
8801template <class A1, class A2, class A3, class A4, class A5>
8802inline
8803Variant5<A1, A2, A3, A4, A5>::Variant5()
8804{
8805}
8806
8807template <class A1, class A2, class A3, class A4, class A5>
8808template <class TYPE_OR_ALLOCATOR>
8809inline
8810Variant5<A1, A2, A3, A4, A5>::
8811Variant5(const TYPE_OR_ALLOCATOR& valueOrAllocator)
8812: Imp(valueOrAllocator)
8813{
8814}
8815
8816template <class A1, class A2, class A3, class A4, class A5>
8817template <class TYPE>
8818inline
8819Variant5<A1, A2, A3, A4, A5>::
8820Variant5(const TYPE& value, bslma::Allocator *basicAllocator)
8821: Imp(value, basicAllocator)
8822{
8823}
8824
8825template <class A1, class A2, class A3, class A4, class A5>
8826template <class TYPE>
8827inline
8828Variant5<A1, A2, A3, A4, A5>::
8829#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8830Variant5(TYPE&& value,
8831 typename bsl::enable_if<
8832 !bsl::is_same<
8833 SelfType,
8834 typename bsl::remove_const<
8835 typename bsl::remove_reference<TYPE>::type>::type>::value
8836 &&
8838 void>::type *)
8839: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8840#else
8841Variant5(bslmf::MovableRef<TYPE> value)
8842: Imp(MoveUtil::move(value))
8843#endif
8844{
8845}
8846
8847template <class A1, class A2, class A3, class A4, class A5>
8848template <class TYPE>
8849inline
8850Variant5<A1, A2, A3, A4, A5>::
8851#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8852Variant5(TYPE&& value,
8853 typename bsl::enable_if<
8854 !bsl::is_same<
8855 SelfType,
8856 typename bsl::remove_const<
8857 typename bsl::remove_reference<TYPE>::type>::type>::value,
8858 bslma::Allocator>::type *basicAllocator)
8859: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
8860#else
8861Variant5(bslmf::MovableRef<TYPE> value,
8862 bslma::Allocator *basicAllocator)
8863: Imp(MoveUtil::move(value), basicAllocator)
8864#endif
8865{
8866}
8867
8868template <class A1, class A2, class A3, class A4, class A5>
8869inline
8870Variant5<A1, A2, A3, A4, A5>::
8871Variant5(const Variant5& original, bslma::Allocator *basicAllocator)
8872: Imp(static_cast<const Imp&>(original), basicAllocator)
8873{
8874}
8875
8876template <class A1, class A2, class A3, class A4, class A5>
8877inline
8878Variant5<A1, A2, A3, A4, A5>::
8879Variant5(bslmf::MovableRef<Variant5> original)
8880: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
8881{
8882}
8883
8884template <class A1, class A2, class A3, class A4, class A5>
8885inline
8886Variant5<A1, A2, A3, A4, A5>::
8887Variant5(bslmf::MovableRef<Variant5> original,
8888 bslma::Allocator *basicAllocator)
8889: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
8890 basicAllocator)
8891{
8892}
8893
8894// MANIPULATORS
8895template <class A1, class A2, class A3, class A4, class A5>
8896template <class TYPE>
8897inline
8898Variant5<A1, A2, A3, A4, A5>&
8899Variant5<A1, A2, A3, A4, A5>::operator=(const TYPE& value)
8900{
8901 Imp::operator=(value);
8902 return *this;
8903}
8904
8905template <class A1, class A2, class A3, class A4, class A5>
8906template <class TYPE>
8907inline
8908#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8909typename bsl::enable_if<
8911 typename bsl::remove_cvref<TYPE>::type>::value,
8912Variant5<A1, A2, A3, A4, A5> >::type&
8913Variant5<A1, A2, A3, A4, A5>::operator=(TYPE&& value)
8914#else
8915Variant5<A1, A2, A3, A4, A5>&
8916Variant5<A1, A2, A3, A4, A5>::operator=(bslmf::MovableRef<TYPE> value)
8917#endif
8918{
8919#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8920 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
8921#else
8922 TYPE& lvalue = value;
8923 Imp::operator=(MoveUtil::move(lvalue));
8924#endif
8925
8926 return *this;
8927}
8928
8929template <class A1, class A2, class A3, class A4, class A5>
8930inline
8931Variant5<A1, A2, A3, A4, A5>&
8932Variant5<A1, A2, A3, A4, A5>::operator=(const Variant5& rhs)
8933{
8934 Imp::operator=(static_cast<const Imp&>(rhs));
8935 return *this;
8936}
8937
8938template <class A1, class A2, class A3, class A4, class A5>
8939inline
8940Variant5<A1, A2, A3, A4, A5>&
8941Variant5<A1, A2, A3, A4, A5>::operator=(bslmf::MovableRef<Variant5> rhs)
8942{
8943 Variant5& lvalue = rhs;
8944
8945 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
8946 return *this;
8947}
8948
8949 // -------------------
8950 // class Variant6<...>
8951 // -------------------
8952
8953// CREATORS
8954template <class A1, class A2, class A3, class A4, class A5, class A6>
8955inline
8956Variant6<A1, A2, A3, A4, A5, A6>::Variant6()
8957{
8958}
8959
8960template <class A1, class A2, class A3, class A4, class A5, class A6>
8961template <class TYPE_OR_ALLOCATOR>
8962inline
8963Variant6<A1, A2, A3, A4, A5, A6>::
8964Variant6(const TYPE_OR_ALLOCATOR& valueOrAllocator)
8965: Imp(valueOrAllocator)
8966{
8967}
8968
8969template <class A1, class A2, class A3, class A4, class A5, class A6>
8970template <class TYPE>
8971inline
8972Variant6<A1, A2, A3, A4, A5, A6>::
8973Variant6(const TYPE& value, bslma::Allocator *basicAllocator)
8974: Imp(value, basicAllocator)
8975{
8976}
8977
8978template <class A1, class A2, class A3, class A4, class A5, class A6>
8979template <class TYPE>
8980inline
8981Variant6<A1, A2, A3, A4, A5, A6>::
8982#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
8983Variant6(TYPE&& value,
8984 typename bsl::enable_if<
8985 !bsl::is_same<
8986 SelfType,
8987 typename bsl::remove_const<
8988 typename bsl::remove_reference<TYPE>::type>::type>::value
8989 &&
8991 void>::type *)
8992: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
8993#else
8994Variant6(bslmf::MovableRef<TYPE> value)
8995: Imp(MoveUtil::move(value))
8996#endif
8997{
8998}
8999
9000template <class A1, class A2, class A3, class A4, class A5, class A6>
9001template <class TYPE>
9002inline
9003Variant6<A1, A2, A3, A4, A5, A6>::
9004#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9005Variant6(TYPE&& value,
9006 typename bsl::enable_if<
9007 !bsl::is_same<
9008 SelfType,
9009 typename bsl::remove_const<
9010 typename bsl::remove_reference<TYPE>::type>::type>::value,
9011 bslma::Allocator>::type *basicAllocator)
9012: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
9013#else
9014Variant6(bslmf::MovableRef<TYPE> value,
9015 bslma::Allocator *basicAllocator)
9016: Imp(MoveUtil::move(value), basicAllocator)
9017#endif
9018{
9019}
9020
9021template <class A1, class A2, class A3, class A4, class A5, class A6>
9022inline
9023Variant6<A1, A2, A3, A4, A5, A6>::
9024Variant6(const Variant6& original, bslma::Allocator *basicAllocator)
9025: Imp(static_cast<const Imp&>(original), basicAllocator)
9026{
9027}
9028
9029template <class A1, class A2, class A3, class A4, class A5, class A6>
9030inline
9031Variant6<A1, A2, A3, A4, A5, A6>::
9032Variant6(bslmf::MovableRef<Variant6> original)
9033: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
9034{
9035}
9036
9037template <class A1, class A2, class A3, class A4, class A5, class A6>
9038inline
9039Variant6<A1, A2, A3, A4, A5, A6>::
9040Variant6(bslmf::MovableRef<Variant6> original,
9041 bslma::Allocator *basicAllocator)
9042: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
9043 basicAllocator)
9044{
9045}
9046
9047// MANIPULATORS
9048template <class A1, class A2, class A3, class A4, class A5, class A6>
9049template <class TYPE>
9050inline
9051Variant6<A1, A2, A3, A4, A5, A6>&
9052Variant6<A1, A2, A3, A4, A5, A6>::operator=(const TYPE& value)
9053{
9054 Imp::operator=(value);
9055 return *this;
9056}
9057
9058template <class A1, class A2, class A3, class A4, class A5, class A6>
9059template <class TYPE>
9060inline
9061#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9062typename bsl::enable_if<
9064 typename bsl::remove_cvref<TYPE>::type>::value,
9065Variant6<A1, A2, A3, A4, A5, A6> >::type&
9066Variant6<A1, A2, A3, A4, A5, A6>::operator=(TYPE&& value)
9067#else
9068Variant6<A1, A2, A3, A4, A5, A6>&
9069Variant6<A1, A2, A3, A4, A5, A6>::operator=(bslmf::MovableRef<TYPE> value)
9070#endif
9071{
9072#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9073 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
9074#else
9075 TYPE& lvalue = value;
9076 Imp::operator=(MoveUtil::move(lvalue));
9077#endif
9078
9079 return *this;
9080}
9081
9082template <class A1, class A2, class A3, class A4, class A5, class A6>
9083inline
9084Variant6<A1, A2, A3, A4, A5, A6>&
9085Variant6<A1, A2, A3, A4, A5, A6>::operator=(const Variant6& rhs)
9086{
9087 Imp::operator=(static_cast<const Imp&>(rhs));
9088 return *this;
9089}
9090
9091template <class A1, class A2, class A3, class A4, class A5, class A6>
9092inline
9093Variant6<A1, A2, A3, A4, A5, A6>&
9094Variant6<A1, A2, A3, A4, A5, A6>::operator=(bslmf::MovableRef<Variant6> rhs)
9095{
9096 Variant6& lvalue = rhs;
9097
9098 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
9099 return *this;
9100}
9101
9102 // -------------------
9103 // class Variant7<...>
9104 // -------------------
9105
9106// CREATORS
9107template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9108inline
9109Variant7<A1, A2, A3, A4, A5, A6, A7>::Variant7()
9110{
9111}
9112
9113template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9114template <class TYPE_OR_ALLOCATOR>
9115inline
9116Variant7<A1, A2, A3, A4, A5, A6, A7>::
9117Variant7(const TYPE_OR_ALLOCATOR& valueOrAllocator)
9118: Imp(valueOrAllocator)
9119{
9120}
9121
9122template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9123template <class TYPE>
9124inline
9125Variant7<A1, A2, A3, A4, A5, A6, A7>::
9126Variant7(const TYPE& value, bslma::Allocator *basicAllocator)
9127: Imp(value, basicAllocator)
9128{
9129}
9130
9131template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9132template <class TYPE>
9133inline
9134Variant7<A1, A2, A3, A4, A5, A6, A7>::
9135#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9136Variant7(TYPE&& value,
9137 typename bsl::enable_if<
9138 !bsl::is_same<
9139 SelfType,
9140 typename bsl::remove_const<
9141 typename bsl::remove_reference<TYPE>::type>::type>::value
9142 &&
9144 void>::type *)
9145: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
9146#else
9147Variant7(bslmf::MovableRef<TYPE> value)
9148: Imp(MoveUtil::move(value))
9149#endif
9150{
9151}
9152
9153template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9154template <class TYPE>
9155inline
9156Variant7<A1, A2, A3, A4, A5, A6, A7>::
9157#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9158Variant7(TYPE&& value,
9159 typename bsl::enable_if<
9160 !bsl::is_same<
9161 SelfType,
9162 typename bsl::remove_const<
9163 typename bsl::remove_reference<TYPE>::type>::type>::value,
9164 bslma::Allocator>::type *basicAllocator)
9165: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
9166#else
9167Variant7(bslmf::MovableRef<TYPE> value,
9168 bslma::Allocator *basicAllocator)
9169: Imp(MoveUtil::move(value), basicAllocator)
9170#endif
9171{
9172}
9173
9174template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9175inline
9176Variant7<A1, A2, A3, A4, A5, A6, A7>::
9177Variant7(const Variant7& original, bslma::Allocator *basicAllocator)
9178: Imp(static_cast<const Imp&>(original), basicAllocator)
9179{
9180}
9181
9182template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9183inline
9184Variant7<A1, A2, A3, A4, A5, A6, A7>::
9185Variant7(bslmf::MovableRef<Variant7> original)
9186: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
9187{
9188}
9189
9190template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9191inline
9192Variant7<A1, A2, A3, A4, A5, A6, A7>::
9193Variant7(bslmf::MovableRef<Variant7> original,
9194 bslma::Allocator *basicAllocator)
9195: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
9196 basicAllocator)
9197{
9198}
9199
9200// MANIPULATORS
9201template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9202template <class TYPE>
9203inline
9204Variant7<A1, A2, A3, A4, A5, A6, A7>&
9205Variant7<A1, A2, A3, A4, A5, A6, A7>::operator=(const TYPE& value)
9206{
9207 Imp::operator=(value);
9208 return *this;
9209}
9210
9211template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9212template <class TYPE>
9213inline
9214#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9215typename bsl::enable_if<
9217 typename bsl::remove_cvref<TYPE>::type>::value,
9218Variant7<A1, A2, A3, A4, A5, A6, A7> >::type&
9219Variant7<A1, A2, A3, A4, A5, A6, A7>::operator=(TYPE&& value)
9220#else
9221Variant7<A1, A2, A3, A4, A5, A6, A7>&
9222Variant7<A1, A2, A3, A4, A5, A6, A7>::operator=(bslmf::MovableRef<TYPE> value)
9223#endif
9224{
9225#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9226 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
9227#else
9228 TYPE& lvalue = value;
9229 Imp::operator=(MoveUtil::move(lvalue));
9230#endif
9231
9232 return *this;
9233}
9234
9235template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9236inline
9237Variant7<A1, A2, A3, A4, A5, A6, A7>&
9238Variant7<A1, A2, A3, A4, A5, A6, A7>::
9239operator=(const Variant7& rhs)
9240{
9241 Imp::operator=(static_cast<const Imp&>(rhs));
9242 return *this;
9243}
9244
9245template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
9246inline
9247Variant7<A1, A2, A3, A4, A5, A6, A7>&
9248Variant7<A1, A2, A3, A4, A5, A6, A7>::
9249operator=(bslmf::MovableRef<Variant7> rhs)
9250{
9251 Variant7& lvalue = rhs;
9252
9253 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
9254 return *this;
9255}
9256
9257 // -------------------
9258 // class Variant8<...>
9259 // -------------------
9260
9261// CREATORS
9262template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9263 class A8>
9264inline
9265Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::Variant8()
9266{
9267}
9268
9269template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9270 class A8>
9271template <class TYPE_OR_ALLOCATOR>
9272inline
9273Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9274Variant8(const TYPE_OR_ALLOCATOR& valueOrAllocator)
9275: Imp(valueOrAllocator)
9276{
9277}
9278
9279template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9280 class A8>
9281template <class TYPE>
9282inline
9283Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9284Variant8(const TYPE& value, bslma::Allocator *basicAllocator)
9285: Imp(value, basicAllocator)
9286{
9287}
9288
9289template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9290 class A8>
9291template <class TYPE>
9292inline
9293Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9294#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9295Variant8(TYPE&& value,
9296 typename bsl::enable_if<
9297 !bsl::is_same<
9298 SelfType,
9299 typename bsl::remove_const<
9300 typename bsl::remove_reference<TYPE>::type>::type>::value
9301 &&
9303 void>::type *)
9304: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
9305#else
9306Variant8(bslmf::MovableRef<TYPE> value)
9307: Imp(MoveUtil::move(value))
9308#endif
9309{
9310}
9311
9312template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9313 class A8>
9314template <class TYPE>
9315inline
9316Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9317#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9318Variant8(TYPE&& value,
9319 typename bsl::enable_if<
9320 !bsl::is_same<
9321 SelfType,
9322 typename bsl::remove_const<
9323 typename bsl::remove_reference<TYPE>::type>::type>::value,
9324 bslma::Allocator>::type *basicAllocator)
9325: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
9326#else
9327Variant8(bslmf::MovableRef<TYPE> value,
9328 bslma::Allocator *basicAllocator)
9329: Imp(MoveUtil::move(value), basicAllocator)
9330#endif
9331{
9332}
9333
9334template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9335 class A8>
9336inline
9337Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9338Variant8(const Variant8& original, bslma::Allocator *basicAllocator)
9339: Imp(static_cast<const Imp&>(original), basicAllocator)
9340{
9341}
9342
9343template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9344 class A8>
9345inline
9346Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9347Variant8(bslmf::MovableRef<Variant8> original)
9348: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
9349{
9350}
9351
9352template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9353 class A8>
9354inline
9355Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9356Variant8(bslmf::MovableRef<Variant8> original,
9357 bslma::Allocator *basicAllocator)
9358: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
9359 basicAllocator)
9360{
9361}
9362
9363// MANIPULATORS
9364template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9365 class A8>
9366template <class TYPE>
9367inline
9368Variant8<A1, A2, A3, A4, A5, A6, A7, A8>&
9369Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::operator=(const TYPE& value)
9370{
9371 Imp::operator=(value);
9372 return *this;
9373}
9374
9375template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9376 class A8>
9377template <class TYPE>
9378inline
9379#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9380typename bsl::enable_if<
9382 typename bsl::remove_cvref<TYPE>::type>::value,
9383Variant8<A1, A2, A3, A4, A5, A6, A7, A8> >::type&
9384Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9385operator=(TYPE&& value)
9386#else
9387Variant8<A1, A2, A3, A4, A5, A6, A7, A8>&
9388Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9389operator=(bslmf::MovableRef<TYPE> value)
9390#endif
9391{
9392#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9393 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
9394#else
9395 TYPE& lvalue = value;
9396 Imp::operator=(MoveUtil::move(lvalue));
9397#endif
9398
9399 return *this;
9400}
9401
9402template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9403 class A8>
9404inline
9405Variant8<A1, A2, A3, A4, A5, A6, A7, A8>&
9406Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9407operator=(const Variant8& rhs)
9408{
9409 Imp::operator=(static_cast<const Imp&>(rhs));
9410 return *this;
9411}
9412
9413template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9414 class A8>
9415inline
9416Variant8<A1, A2, A3, A4, A5, A6, A7, A8>&
9417Variant8<A1, A2, A3, A4, A5, A6, A7, A8>::
9418operator=(bslmf::MovableRef<Variant8> rhs)
9419{
9420 Variant8& lvalue = rhs;
9421
9422 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
9423 return *this;
9424}
9425
9426 // -------------------
9427 // class Variant9<...>
9428 // -------------------
9429
9430// CREATORS
9431template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9432 class A8, class A9>
9433inline
9434Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::Variant9()
9435{
9436}
9437
9438template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9439 class A8, class A9>
9440template <class TYPE_OR_ALLOCATOR>
9441inline
9442Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9443Variant9(const TYPE_OR_ALLOCATOR& valueOrAllocator)
9444: Imp(valueOrAllocator)
9445{
9446}
9447
9448template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9449 class A8, class A9>
9450template <class TYPE>
9451inline
9452Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9453Variant9(const TYPE& value, bslma::Allocator *basicAllocator)
9454: Imp(value, basicAllocator)
9455{
9456}
9457
9458template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9459 class A8, class A9>
9460template <class TYPE>
9461inline
9462Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9463#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9464Variant9(TYPE&& value,
9465 typename bsl::enable_if<
9466 !bsl::is_same<
9467 SelfType,
9468 typename bsl::remove_const<
9469 typename bsl::remove_reference<TYPE>::type>::type>::value
9470 &&
9472 void>::type *)
9473: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
9474#else
9475Variant9(bslmf::MovableRef<TYPE> value)
9476: Imp(MoveUtil::move(value))
9477#endif
9478{
9479}
9480
9481template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9482 class A8, class A9>
9483template <class TYPE>
9484inline
9485Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9486#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9487Variant9(TYPE&& value,
9488 typename bsl::enable_if<
9489 !bsl::is_same<
9490 SelfType,
9491 typename bsl::remove_const<
9492 typename bsl::remove_reference<TYPE>::type>::type>::value,
9493 bslma::Allocator>::type *basicAllocator)
9494: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
9495#else
9496Variant9(bslmf::MovableRef<TYPE> value,
9497 bslma::Allocator *basicAllocator)
9498: Imp(MoveUtil::move(value), basicAllocator)
9499#endif
9500{
9501}
9502
9503template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9504 class A8, class A9>
9505inline
9506Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9507Variant9(const Variant9& original, bslma::Allocator *basicAllocator)
9508: Imp(static_cast<const Imp&>(original), basicAllocator)
9509{
9510}
9511
9512template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9513 class A8, class A9>
9514inline
9515Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9516Variant9(bslmf::MovableRef<Variant9> original)
9517: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
9518{
9519}
9520
9521template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9522 class A8, class A9>
9523inline
9524Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9525Variant9(bslmf::MovableRef<Variant9> original,
9526 bslma::Allocator *basicAllocator)
9527: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
9528 basicAllocator)
9529{
9530}
9531
9532// MANIPULATORS
9533template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9534 class A8, class A9>
9535template <class TYPE>
9536inline
9537Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>&
9538Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9539operator=(const TYPE& value)
9540{
9541 Imp::operator=(value);
9542 return *this;
9543}
9544
9545template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9546 class A8, class A9>
9547template <class TYPE>
9548inline
9549#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9550typename bsl::enable_if<
9552 typename bsl::remove_cvref<TYPE>::type>::value,
9553Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9> >::type&
9554Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9555operator=(TYPE&& value)
9556#else
9557Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>&
9558Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9559operator=(bslmf::MovableRef<TYPE> value)
9560#endif
9561{
9562#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9563 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
9564#else
9565 TYPE& lvalue = value;
9566 Imp::operator=(MoveUtil::move(lvalue));
9567#endif
9568
9569 return *this;
9570}
9571
9572template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9573 class A8, class A9>
9574inline
9575Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>&
9576Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9577operator=(const Variant9& rhs)
9578{
9579 Imp::operator=(static_cast<const Imp&>(rhs));
9580 return *this;
9581}
9582
9583template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9584 class A8, class A9>
9585inline
9586Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>&
9587Variant9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::
9588operator=(bslmf::MovableRef<Variant9> rhs)
9589{
9590 Variant9& lvalue = rhs;
9591
9592 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
9593 return *this;
9594}
9595
9596 // --------------------
9597 // class Variant10<...>
9598 // --------------------
9599
9600// CREATORS
9601template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9602 class A8, class A9, class A10>
9603inline
9604Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::Variant10()
9605{
9606}
9607
9608template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9609 class A8, class A9, class A10>
9610template <class TYPE_OR_ALLOCATOR>
9611inline
9612Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9613Variant10(const TYPE_OR_ALLOCATOR& valueOrAllocator)
9614: Imp(valueOrAllocator)
9615{
9616}
9617
9618template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9619 class A8, class A9, class A10>
9620template <class TYPE>
9621inline
9622Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9623Variant10(const TYPE& value, bslma::Allocator *basicAllocator)
9624: Imp(value, basicAllocator)
9625{
9626}
9627
9628template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9629 class A8, class A9, class A10>
9630template <class TYPE>
9631inline
9632Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9633#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9634Variant10(TYPE&& value,
9635 typename bsl::enable_if<
9636 !bsl::is_same<
9637 SelfType,
9638 typename bsl::remove_const<
9639 typename bsl::remove_reference<TYPE>::type>::type>::value
9640 &&
9642 void>::type *)
9643: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
9644#else
9645Variant10(bslmf::MovableRef<TYPE> value)
9646: Imp(MoveUtil::move(value))
9647#endif
9648{
9649}
9650
9651template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9652 class A8, class A9, class A10>
9653template <class TYPE>
9654inline
9655Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9656#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9657Variant10(TYPE&& value,
9658 typename bsl::enable_if<
9659 !bsl::is_same<
9660 SelfType,
9661 typename bsl::remove_const<
9662 typename bsl::remove_reference<TYPE>::type>::type>::value,
9663 bslma::Allocator>::type *basicAllocator)
9664: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
9665#else
9666Variant10(bslmf::MovableRef<TYPE> value,
9667 bslma::Allocator *basicAllocator)
9668: Imp(MoveUtil::move(value), basicAllocator)
9669#endif
9670{
9671}
9672
9673template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9674 class A8, class A9, class A10>
9675inline
9676Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9677Variant10(const Variant10& original, bslma::Allocator *basicAllocator)
9678: Imp(static_cast<const Imp&>(original), basicAllocator)
9679{
9680}
9681
9682template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9683 class A8, class A9, class A10>
9684inline
9685Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9686Variant10(bslmf::MovableRef<Variant10> original)
9687: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
9688{
9689}
9690
9691template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9692 class A8, class A9, class A10>
9693inline
9694Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9695Variant10(bslmf::MovableRef<Variant10> original,
9696 bslma::Allocator *basicAllocator)
9697: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
9698 basicAllocator)
9699{
9700}
9701
9702// MANIPULATORS
9703template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9704 class A8, class A9, class A10>
9705template <class TYPE>
9706inline
9707Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>&
9708Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9709operator=(const TYPE& value)
9710{
9711 Imp::operator=(value);
9712 return *this;
9713}
9714
9715template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9716 class A8, class A9, class A10>
9717template <class TYPE>
9718inline
9719#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9720typename bsl::enable_if<
9722 typename bsl::remove_cvref<TYPE>::type>::value,
9723Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> >::type&
9724Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9725operator=(TYPE&& value)
9726#else
9727Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>&
9728Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9729operator=(bslmf::MovableRef<TYPE> value)
9730#endif
9731{
9732#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9733 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
9734#else
9735 TYPE& lvalue = value;
9736 Imp::operator=(MoveUtil::move(lvalue));
9737#endif
9738
9739 return *this;
9740}
9741
9742template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9743 class A8, class A9, class A10>
9744inline
9745Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>&
9746Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9747operator=(const Variant10& rhs)
9748{
9749 Imp::operator=(static_cast<const Imp&>(rhs));
9750 return *this;
9751}
9752
9753template <class A1, class A2, class A3, class A4, class A5, class A6, class A7,
9754 class A8, class A9, class A10>
9755inline
9756Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>&
9757Variant10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::
9758operator=(bslmf::MovableRef<Variant10> rhs)
9759{
9760 Variant10& lvalue = rhs;
9761
9762 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
9763 return *this;
9764}
9765
9766 // --------------------
9767 // class Variant11<...>
9768 // --------------------
9769
9770// CREATORS
9771template <class A1, class A2, class A3, class A4, class A5, class A6,
9772 class A7, class A8, class A9, class A10, class A11>
9773inline
9774Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9775Variant11()
9776{
9777}
9778
9779template <class A1, class A2, class A3, class A4, class A5, class A6,
9780 class A7, class A8, class A9, class A10, class A11>
9781template <class TYPE_OR_ALLOCATOR>
9782inline
9783Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9784Variant11(const TYPE_OR_ALLOCATOR& valueOrAllocator)
9785: Imp(valueOrAllocator)
9786{
9787}
9788
9789template <class A1, class A2, class A3, class A4, class A5, class A6,
9790 class A7, class A8, class A9, class A10, class A11>
9791template <class TYPE>
9792inline
9793Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9794Variant11(const TYPE& value, bslma::Allocator *basicAllocator)
9795: Imp(value, basicAllocator)
9796{
9797}
9798
9799template <class A1, class A2, class A3, class A4, class A5, class A6,
9800 class A7, class A8, class A9, class A10, class A11>
9801template <class TYPE>
9802inline
9803Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9804#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9805Variant11(TYPE&& value,
9806 typename bsl::enable_if<
9807 !bsl::is_same<
9808 SelfType,
9809 typename bsl::remove_const<
9810 typename bsl::remove_reference<TYPE>::type>::type>::value
9811 &&
9813 void>::type *)
9814: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
9815#else
9816Variant11(bslmf::MovableRef<TYPE> value)
9817: Imp(MoveUtil::move(value))
9818#endif
9819{
9820}
9821
9822template <class A1, class A2, class A3, class A4, class A5, class A6,
9823 class A7, class A8, class A9, class A10, class A11>
9824template <class TYPE>
9825inline
9826Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9827#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9828Variant11(TYPE&& value,
9829 typename bsl::enable_if<
9830 !bsl::is_same<
9831 SelfType,
9832 typename bsl::remove_const<
9833 typename bsl::remove_reference<TYPE>::type>::type>::value,
9834 bslma::Allocator>::type *basicAllocator)
9835: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
9836#else
9837Variant11(bslmf::MovableRef<TYPE> value,
9838 bslma::Allocator *basicAllocator)
9839: Imp(MoveUtil::move(value), basicAllocator)
9840#endif
9841{
9842}
9843
9844template <class A1, class A2, class A3, class A4, class A5, class A6,
9845 class A7, class A8, class A9, class A10, class A11>
9846inline
9847Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9848Variant11(const Variant11& original, bslma::Allocator *basicAllocator)
9849: Imp(static_cast<const Imp&>(original), basicAllocator)
9850{
9851}
9852
9853template <class A1, class A2, class A3, class A4, class A5, class A6,
9854 class A7, class A8, class A9, class A10, class A11>
9855inline
9856Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9857Variant11(bslmf::MovableRef<Variant11> original)
9858: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
9859{
9860}
9861
9862template <class A1, class A2, class A3, class A4, class A5, class A6,
9863 class A7, class A8, class A9, class A10, class A11>
9864inline
9865Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9866Variant11(bslmf::MovableRef<Variant11> original,
9867 bslma::Allocator *basicAllocator)
9868: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
9869 basicAllocator)
9870{
9871}
9872
9873// MANIPULATORS
9874template <class A1, class A2, class A3, class A4, class A5, class A6,
9875 class A7, class A8, class A9, class A10, class A11>
9876template <class TYPE>
9877inline
9878Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>&
9879Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9880operator=(const TYPE& value)
9881{
9882 Imp::operator=(value);
9883 return *this;
9884}
9885
9886template <class A1, class A2, class A3, class A4, class A5, class A6,
9887 class A7, class A8, class A9, class A10, class A11>
9888template <class TYPE>
9889inline
9890#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9891typename bsl::enable_if<
9893 typename bsl::remove_cvref<TYPE>::type>::value,
9894Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> >::type&
9895Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9896operator=(TYPE&& value)
9897#else
9898Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>&
9899Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9900operator=(bslmf::MovableRef<TYPE> value)
9901#endif
9902{
9903#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9904 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
9905#else
9906 TYPE& lvalue = value;
9907 Imp::operator=(MoveUtil::move(lvalue));
9908#endif
9909
9910 return *this;
9911}
9912
9913template <class A1, class A2, class A3, class A4, class A5, class A6,
9914 class A7, class A8, class A9, class A10, class A11>
9915inline
9916Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>&
9917Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9918operator=(const Variant11& rhs)
9919{
9920 Imp::operator=(static_cast<const Imp&>(rhs));
9921 return *this;
9922}
9923
9924template <class A1, class A2, class A3, class A4, class A5, class A6,
9925 class A7, class A8, class A9, class A10, class A11>
9926inline
9927Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>&
9928Variant11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::
9929operator=(bslmf::MovableRef<Variant11> rhs)
9930{
9931 Variant11& lvalue = rhs;
9932
9933 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
9934 return *this;
9935}
9936
9937 // --------------------
9938 // class Variant12<...>
9939 // --------------------
9940
9941// CREATORS
9942template <class A1, class A2, class A3, class A4, class A5, class A6,
9943 class A7, class A8, class A9, class A10, class A11, class A12>
9944inline
9945Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
9946Variant12()
9947{
9948}
9949
9950template <class A1, class A2, class A3, class A4, class A5, class A6,
9951 class A7, class A8, class A9, class A10, class A11, class A12>
9952template <class TYPE_OR_ALLOCATOR>
9953inline
9954Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
9955Variant12(const TYPE_OR_ALLOCATOR& valueOrAllocator)
9956: Imp(valueOrAllocator)
9957{
9958}
9959
9960template <class A1, class A2, class A3, class A4, class A5, class A6,
9961 class A7, class A8, class A9, class A10, class A11, class A12>
9962template <class TYPE>
9963inline
9964Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
9965Variant12(const TYPE& value, bslma::Allocator *basicAllocator)
9966: Imp(value, basicAllocator)
9967{
9968}
9969
9970template <class A1, class A2, class A3, class A4, class A5, class A6,
9971 class A7, class A8, class A9, class A10, class A11, class A12>
9972template <class TYPE>
9973inline
9974Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
9975#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9976Variant12(TYPE&& value,
9977 typename bsl::enable_if<
9978 !bsl::is_same<
9979 SelfType,
9980 typename bsl::remove_const<
9981 typename bsl::remove_reference<TYPE>::type>::type>::value
9982 &&
9984 void>::type *)
9985: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
9986#else
9987Variant12(bslmf::MovableRef<TYPE> value)
9988: Imp(MoveUtil::move(value))
9989#endif
9990{
9991}
9992
9993template <class A1, class A2, class A3, class A4, class A5, class A6,
9994 class A7, class A8, class A9, class A10, class A11, class A12>
9995template <class TYPE>
9996inline
9997Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
9998#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
9999Variant12(TYPE&& value,
10000 typename bsl::enable_if<
10001 !bsl::is_same<
10002 SelfType,
10003 typename bsl::remove_const<
10004 typename bsl::remove_reference<TYPE>::type>::type>::value,
10005 bslma::Allocator>::type *basicAllocator)
10006: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
10007#else
10008Variant12(bslmf::MovableRef<TYPE> value,
10009 bslma::Allocator *basicAllocator)
10010: Imp(MoveUtil::move(value), basicAllocator)
10011#endif
10012{
10013}
10014
10015template <class A1, class A2, class A3, class A4, class A5, class A6,
10016 class A7, class A8, class A9, class A10, class A11, class A12>
10017inline
10018Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10019Variant12(const Variant12& original, bslma::Allocator *basicAllocator)
10020: Imp(static_cast<const Imp&>(original), basicAllocator)
10021{
10022}
10023
10024template <class A1, class A2, class A3, class A4, class A5, class A6,
10025 class A7, class A8, class A9, class A10, class A11, class A12>
10026inline
10027Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10028Variant12(bslmf::MovableRef<Variant12> original)
10029: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
10030{
10031}
10032
10033template <class A1, class A2, class A3, class A4, class A5, class A6,
10034 class A7, class A8, class A9, class A10, class A11, class A12>
10035inline
10036Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10037Variant12(bslmf::MovableRef<Variant12> original,
10038 bslma::Allocator *basicAllocator)
10039: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
10040 basicAllocator)
10041{
10042}
10043
10044// MANIPULATORS
10045template <class A1, class A2, class A3, class A4, class A5, class A6,
10046 class A7, class A8, class A9, class A10, class A11, class A12>
10047template <class TYPE>
10048inline
10049Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>&
10050Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10051operator=(const TYPE& value)
10052{
10053 Imp::operator=(value);
10054 return *this;
10055}
10056
10057template <class A1, class A2, class A3, class A4, class A5, class A6,
10058 class A7, class A8, class A9, class A10, class A11, class A12>
10059template <class TYPE>
10060inline
10061#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10062typename bsl::enable_if<
10064 typename bsl::remove_cvref<TYPE>::type>::value,
10065Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> >::type&
10066Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10067operator=(TYPE&& value)
10068#else
10069Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>&
10070Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10071operator=(bslmf::MovableRef<TYPE> value)
10072#endif
10073{
10074#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10075 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
10076#else
10077 TYPE& lvalue = value;
10078 Imp::operator=(MoveUtil::move(lvalue));
10079#endif
10080
10081 return *this;
10082}
10083
10084template <class A1, class A2, class A3, class A4, class A5, class A6,
10085 class A7, class A8, class A9, class A10, class A11, class A12>
10086inline
10087Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>&
10088Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10089operator=(const Variant12& rhs)
10090{
10091 Imp::operator=(static_cast<const Imp&>(rhs));
10092 return *this;
10093}
10094
10095template <class A1, class A2, class A3, class A4, class A5, class A6,
10096 class A7, class A8, class A9, class A10, class A11, class A12>
10097inline
10098Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>&
10099Variant12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>::
10100operator=(bslmf::MovableRef<Variant12> rhs)
10101{
10102 Variant12& lvalue = rhs;
10103
10104 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
10105 return *this;
10106}
10107
10108 // --------------------
10109 // class Variant13<...>
10110 // --------------------
10111
10112// CREATORS
10113template <class A1, class A2, class A3, class A4, class A5, class A6,
10114 class A7, class A8, class A9, class A10, class A11, class A12,
10115 class A13>
10116inline
10117Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10118Variant13()
10119{
10120}
10121
10122template <class A1, class A2, class A3, class A4, class A5, class A6,
10123 class A7, class A8, class A9, class A10, class A11, class A12,
10124 class A13>
10125template <class TYPE_OR_ALLOCATOR>
10126inline
10127Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10128Variant13(const TYPE_OR_ALLOCATOR& valueOrAllocator)
10129: Imp(valueOrAllocator)
10130{
10131}
10132
10133template <class A1, class A2, class A3, class A4, class A5, class A6,
10134 class A7, class A8, class A9, class A10, class A11, class A12,
10135 class A13>
10136template <class TYPE>
10137inline
10138Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10139Variant13(const TYPE& value, bslma::Allocator *basicAllocator)
10140: Imp(value, basicAllocator)
10141{
10142}
10143
10144template <class A1, class A2, class A3, class A4, class A5, class A6,
10145 class A7, class A8, class A9, class A10, class A11, class A12,
10146 class A13>
10147template <class TYPE>
10148inline
10149Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10150#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10151Variant13(TYPE&& value,
10152 typename bsl::enable_if<
10153 !bsl::is_same<
10154 SelfType,
10155 typename bsl::remove_const<
10156 typename bsl::remove_reference<TYPE>::type>::type>::value
10157 &&
10159 void>::type *)
10160: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
10161#else
10162Variant13(bslmf::MovableRef<TYPE> value)
10163: Imp(MoveUtil::move(value))
10164#endif
10165{
10166}
10167
10168template <class A1, class A2, class A3, class A4, class A5, class A6,
10169 class A7, class A8, class A9, class A10, class A11, class A12,
10170 class A13>
10171template <class TYPE>
10172inline
10173Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10174#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10175Variant13(TYPE&& value,
10176 typename bsl::enable_if<
10177 !bsl::is_same<
10178 SelfType,
10179 typename bsl::remove_const<
10180 typename bsl::remove_reference<TYPE>::type>::type>::value,
10181 bslma::Allocator>::type *basicAllocator)
10182: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
10183#else
10184Variant13(bslmf::MovableRef<TYPE> value,
10185 bslma::Allocator *basicAllocator)
10186: Imp(MoveUtil::move(value), basicAllocator)
10187#endif
10188{
10189}
10190
10191template <class A1, class A2, class A3, class A4, class A5, class A6,
10192 class A7, class A8, class A9, class A10, class A11, class A12,
10193 class A13>
10194inline
10195Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10196Variant13(const Variant13& original, bslma::Allocator *basicAllocator)
10197: Imp(static_cast<const Imp&>(original), basicAllocator)
10198{
10199}
10200
10201template <class A1, class A2, class A3, class A4, class A5, class A6,
10202 class A7, class A8, class A9, class A10, class A11, class A12,
10203 class A13>
10204inline
10205Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10206Variant13(bslmf::MovableRef<Variant13> original)
10207: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
10208{
10209}
10210
10211template <class A1, class A2, class A3, class A4, class A5, class A6,
10212 class A7, class A8, class A9, class A10, class A11, class A12,
10213 class A13>
10214inline
10215Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10216Variant13(bslmf::MovableRef<Variant13> original,
10217 bslma::Allocator *basicAllocator)
10218: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
10219 basicAllocator)
10220{
10221}
10222
10223// MANIPULATORS
10224template <class A1, class A2, class A3, class A4, class A5, class A6,
10225 class A7, class A8, class A9, class A10, class A11, class A12,
10226 class A13>
10227template <class TYPE>
10228inline
10229Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>&
10230Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10231operator=(const TYPE& value)
10232{
10233 Imp::operator=(value);
10234 return *this;
10235}
10236
10237template <class A1, class A2, class A3, class A4, class A5, class A6,
10238 class A7, class A8, class A9, class A10, class A11, class A12,
10239 class A13>
10240template <class TYPE>
10241inline
10242#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10243typename bsl::enable_if<
10244 !bsl::is_same<Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
10245 A13>,
10246 typename bsl::remove_cvref<TYPE>::type>::value,
10247Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> >::type&
10248Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10249operator=(TYPE&& value)
10250#else
10251Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>&
10252Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10253operator=(bslmf::MovableRef<TYPE> value)
10254#endif
10255{
10256#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10257 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
10258#else
10259 TYPE& lvalue = value;
10260 Imp::operator=(MoveUtil::move(lvalue));
10261#endif
10262
10263 return *this;
10264}
10265
10266template <class A1, class A2, class A3, class A4, class A5, class A6,
10267 class A7, class A8, class A9, class A10, class A11, class A12,
10268 class A13>
10269inline
10270Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>&
10271Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10272operator=(const Variant13& rhs)
10273{
10274 Imp::operator=(static_cast<const Imp&>(rhs));
10275 return *this;
10276}
10277
10278template <class A1, class A2, class A3, class A4, class A5, class A6,
10279 class A7, class A8, class A9, class A10, class A11, class A12,
10280 class A13>
10281inline
10282Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>&
10283Variant13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>::
10284operator=(bslmf::MovableRef<Variant13> rhs)
10285{
10286 Variant13& lvalue = rhs;
10287
10288 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
10289 return *this;
10290}
10291
10292 // --------------------
10293 // class Variant14<...>
10294 // --------------------
10295
10296// CREATORS
10297template <class A1, class A2, class A3, class A4, class A5, class A6,
10298 class A7, class A8, class A9, class A10, class A11, class A12,
10299 class A13, class A14>
10300inline
10301Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10302Variant14()
10303{
10304}
10305
10306template <class A1, class A2, class A3, class A4, class A5, class A6,
10307 class A7, class A8, class A9, class A10, class A11, class A12,
10308 class A13, class A14>
10309template <class TYPE_OR_ALLOCATOR>
10310inline
10311Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10312Variant14(const TYPE_OR_ALLOCATOR& valueOrAllocator)
10313: Imp(valueOrAllocator)
10314{
10315}
10316
10317template <class A1, class A2, class A3, class A4, class A5, class A6,
10318 class A7, class A8, class A9, class A10, class A11, class A12,
10319 class A13, class A14>
10320template <class TYPE>
10321inline
10322Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10323Variant14(const TYPE& value, bslma::Allocator *basicAllocator)
10324: Imp(value, basicAllocator)
10325{
10326}
10327
10328template <class A1, class A2, class A3, class A4, class A5, class A6,
10329 class A7, class A8, class A9, class A10, class A11, class A12,
10330 class A13, class A14>
10331template <class TYPE>
10332inline
10333Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10334#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10335Variant14(TYPE&& value,
10336 typename bsl::enable_if<
10337 !bsl::is_same<
10338 SelfType,
10339 typename bsl::remove_const<
10340 typename bsl::remove_reference<TYPE>::type>::type>::value
10341 &&
10343 void>::type *)
10344: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
10345#else
10346Variant14(bslmf::MovableRef<TYPE> value)
10347: Imp(MoveUtil::move(value))
10348#endif
10349{
10350}
10351
10352template <class A1, class A2, class A3, class A4, class A5, class A6,
10353 class A7, class A8, class A9, class A10, class A11, class A12,
10354 class A13, class A14>
10355template <class TYPE>
10356inline
10357Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10358#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10359Variant14(TYPE&& value,
10360 typename bsl::enable_if<
10361 !bsl::is_same<
10362 SelfType,
10363 typename bsl::remove_const<
10364 typename bsl::remove_reference<TYPE>::type>::type>::value,
10365 bslma::Allocator>::type *basicAllocator)
10366: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
10367#else
10368Variant14(bslmf::MovableRef<TYPE> value,
10369 bslma::Allocator *basicAllocator)
10370: Imp(MoveUtil::move(value), basicAllocator)
10371#endif
10372{
10373}
10374
10375template <class A1, class A2, class A3, class A4, class A5, class A6,
10376 class A7, class A8, class A9, class A10, class A11, class A12,
10377 class A13, class A14>
10378inline
10379Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10380Variant14(const Variant14& original, bslma::Allocator *basicAllocator)
10381: Imp(static_cast<const Imp&>(original), basicAllocator)
10382{
10383}
10384
10385template <class A1, class A2, class A3, class A4, class A5, class A6,
10386 class A7, class A8, class A9, class A10, class A11, class A12,
10387 class A13, class A14>
10388inline
10389Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10390Variant14(bslmf::MovableRef<Variant14> original)
10391: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
10392{
10393}
10394
10395template <class A1, class A2, class A3, class A4, class A5, class A6,
10396 class A7, class A8, class A9, class A10, class A11, class A12,
10397 class A13, class A14>
10398inline
10399Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10400Variant14(bslmf::MovableRef<Variant14> original,
10401 bslma::Allocator *basicAllocator)
10402: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
10403 basicAllocator)
10404{
10405}
10406
10407// MANIPULATORS
10408template <class A1, class A2, class A3, class A4, class A5, class A6,
10409 class A7, class A8, class A9, class A10, class A11, class A12,
10410 class A13, class A14>
10411template <class TYPE>
10412inline
10413Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>&
10414Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10415operator=(const TYPE& value)
10416{
10417 Imp::operator=(value);
10418 return *this;
10419}
10420
10421template <class A1, class A2, class A3, class A4, class A5, class A6,
10422 class A7, class A8, class A9, class A10, class A11, class A12,
10423 class A13, class A14>
10424template <class TYPE>
10425inline
10426#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10427typename bsl::enable_if<
10428 !bsl::is_same<Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12,
10429 A13, A14>,
10430 typename bsl::remove_cvref<TYPE>::type>::value,
10431Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> >::type&
10432Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10433operator=(TYPE&& value)
10434#else
10435Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>&
10436Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10437operator=(bslmf::MovableRef<TYPE> value)
10438#endif
10439{
10440#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10441 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
10442#else
10443 TYPE& lvalue = value;
10444 Imp::operator=(MoveUtil::move(lvalue));
10445#endif
10446
10447 return *this;
10448}
10449
10450template <class A1, class A2, class A3, class A4, class A5, class A6,
10451 class A7, class A8, class A9, class A10, class A11, class A12,
10452 class A13, class A14>
10453inline
10454Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>&
10455Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10456operator=(const Variant14& rhs)
10457{
10458 Imp::operator=(static_cast<const Imp&>(rhs));
10459 return *this;
10460}
10461
10462template <class A1, class A2, class A3, class A4, class A5, class A6,
10463 class A7, class A8, class A9, class A10, class A11, class A12,
10464 class A13, class A14>
10465inline
10466Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>&
10467Variant14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>::
10468operator=(bslmf::MovableRef<Variant14> rhs)
10469{
10470 Variant14& lvalue = rhs;
10471
10472 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
10473 return *this;
10474}
10475
10476 // --------------------
10477 // class Variant15<...>
10478 // --------------------
10479
10480// CREATORS
10481template <class A1, class A2, class A3, class A4, class A5, class A6,
10482 class A7, class A8, class A9, class A10, class A11, class A12,
10483 class A13, class A14, class A15>
10484inline
10485Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10486Variant15()
10487{
10488}
10489
10490template <class A1, class A2, class A3, class A4, class A5, class A6,
10491 class A7, class A8, class A9, class A10, class A11, class A12,
10492 class A13, class A14, class A15>
10493template <class TYPE_OR_ALLOCATOR>
10494inline
10495Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10496Variant15(const TYPE_OR_ALLOCATOR& valueOrAllocator)
10497: Imp(valueOrAllocator)
10498{
10499}
10500
10501template <class A1, class A2, class A3, class A4, class A5, class A6,
10502 class A7, class A8, class A9, class A10, class A11, class A12,
10503 class A13, class A14, class A15>
10504template <class TYPE>
10505inline
10506Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10507Variant15(const TYPE& value, bslma::Allocator *basicAllocator)
10508: Imp(value, basicAllocator)
10509{
10510}
10511
10512template <class A1, class A2, class A3, class A4, class A5, class A6,
10513 class A7, class A8, class A9, class A10, class A11, class A12,
10514 class A13, class A14, class A15>
10515template <class TYPE>
10516inline
10517Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10518#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10519Variant15(TYPE&& value,
10520 typename bsl::enable_if<
10521 !bsl::is_same<
10522 SelfType,
10523 typename bsl::remove_const<
10524 typename bsl::remove_reference<TYPE>::type>::type>::value
10525 &&
10527 void>::type *)
10528: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
10529#else
10530Variant15(bslmf::MovableRef<TYPE> value)
10531: Imp(MoveUtil::move(value))
10532#endif
10533{
10534}
10535
10536template <class A1, class A2, class A3, class A4, class A5, class A6,
10537 class A7, class A8, class A9, class A10, class A11, class A12,
10538 class A13, class A14, class A15>
10539template <class TYPE>
10540inline
10541Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10542#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10543Variant15(TYPE&& value,
10544 typename bsl::enable_if<
10545 !bsl::is_same<
10546 SelfType,
10547 typename bsl::remove_const<
10548 typename bsl::remove_reference<TYPE>::type>::type>::value,
10549 bslma::Allocator>::type *basicAllocator)
10550: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
10551#else
10552Variant15(bslmf::MovableRef<TYPE> value,
10553 bslma::Allocator *basicAllocator)
10554: Imp(MoveUtil::move(value), basicAllocator)
10555#endif
10556{
10557}
10558
10559template <class A1, class A2, class A3, class A4, class A5, class A6,
10560 class A7, class A8, class A9, class A10, class A11, class A12,
10561 class A13, class A14, class A15>
10562inline
10563Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10564Variant15(const Variant15& original, bslma::Allocator *basicAllocator)
10565: Imp(static_cast<const Imp&>(original), basicAllocator)
10566{
10567}
10568
10569template <class A1, class A2, class A3, class A4, class A5, class A6,
10570 class A7, class A8, class A9, class A10, class A11, class A12,
10571 class A13, class A14, class A15>
10572inline
10573Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10574Variant15(bslmf::MovableRef<Variant15> original)
10575: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
10576{
10577}
10578
10579template <class A1, class A2, class A3, class A4, class A5, class A6,
10580 class A7, class A8, class A9, class A10, class A11, class A12,
10581 class A13, class A14, class A15>
10582inline
10583Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10584Variant15(bslmf::MovableRef<Variant15> original,
10585 bslma::Allocator *basicAllocator)
10586: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
10587 basicAllocator)
10588{
10589}
10590
10591// MANIPULATORS
10592template <class A1, class A2, class A3, class A4, class A5, class A6,
10593 class A7, class A8, class A9, class A10, class A11, class A12,
10594 class A13, class A14, class A15>
10595template <class TYPE>
10596inline
10597Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>&
10598Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10599operator=(const TYPE& value)
10600{
10601 Imp::operator=(value);
10602 return *this;
10603}
10604
10605template <class A1, class A2, class A3, class A4, class A5, class A6,
10606 class A7, class A8, class A9, class A10, class A11, class A12,
10607 class A13, class A14, class A15>
10608template <class TYPE>
10609inline
10610#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10611typename bsl::enable_if<
10612 !bsl::is_same<Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11,
10613 A12, A13, A14, A15>,
10614 typename bsl::remove_cvref<TYPE>::type>::value,
10615Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10616 A15> >::type&
10617Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10618operator=(TYPE&& value)
10619#else
10620Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>&
10621Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10622operator=(bslmf::MovableRef<TYPE> value)
10623#endif
10624{
10625#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10626 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
10627#else
10628 TYPE& lvalue = value;
10629 Imp::operator=(MoveUtil::move(lvalue));
10630#endif
10631
10632 return *this;
10633}
10634
10635template <class A1, class A2, class A3, class A4, class A5, class A6,
10636 class A7, class A8, class A9, class A10, class A11, class A12,
10637 class A13, class A14, class A15>
10638inline
10639Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>&
10640Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10641operator=(const Variant15& rhs)
10642{
10643 Imp::operator=(static_cast<const Imp&>(rhs));
10644 return *this;
10645}
10646
10647template <class A1, class A2, class A3, class A4, class A5, class A6,
10648 class A7, class A8, class A9, class A10, class A11, class A12,
10649 class A13, class A14, class A15>
10650inline
10651Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>&
10652Variant15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>::
10653operator=(bslmf::MovableRef<Variant15> rhs)
10654{
10655 Variant15& lvalue = rhs;
10656
10657 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
10658 return *this;
10659}
10660
10661 // --------------------
10662 // class Variant16<...>
10663 // --------------------
10664
10665// CREATORS
10666template <class A1, class A2, class A3, class A4, class A5, class A6,
10667 class A7, class A8, class A9, class A10, class A11, class A12,
10668 class A13, class A14, class A15, class A16>
10669inline
10670Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10671 A15, A16>::
10672Variant16()
10673{
10674}
10675
10676template <class A1, class A2, class A3, class A4, class A5, class A6,
10677 class A7, class A8, class A9, class A10, class A11, class A12,
10678 class A13, class A14, class A15, class A16>
10679template <class TYPE_OR_ALLOCATOR>
10680inline
10681Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10682 A15, A16>::
10683Variant16(const TYPE_OR_ALLOCATOR& valueOrAllocator)
10684: Imp(valueOrAllocator)
10685{
10686}
10687
10688template <class A1, class A2, class A3, class A4, class A5, class A6,
10689 class A7, class A8, class A9, class A10, class A11, class A12,
10690 class A13, class A14, class A15, class A16>
10691template <class TYPE>
10692inline
10693Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10694 A15, A16>::
10695Variant16(const TYPE& value, bslma::Allocator *basicAllocator)
10696: Imp(value, basicAllocator)
10697{
10698}
10699
10700template <class A1, class A2, class A3, class A4, class A5, class A6,
10701 class A7, class A8, class A9, class A10, class A11, class A12,
10702 class A13, class A14, class A15, class A16>
10703template <class TYPE>
10704inline
10705Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10706 A15, A16>::
10707#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10708Variant16(TYPE&& value,
10709 typename bsl::enable_if<
10710 !bsl::is_same<
10711 SelfType,
10712 typename bsl::remove_const<
10713 typename bsl::remove_reference<TYPE>::type>::type>::value
10714 &&
10716 void>::type *)
10717: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
10718#else
10719Variant16(bslmf::MovableRef<TYPE> value)
10720: Imp(MoveUtil::move(value))
10721#endif
10722{
10723}
10724
10725template <class A1, class A2, class A3, class A4, class A5, class A6,
10726 class A7, class A8, class A9, class A10, class A11, class A12,
10727 class A13, class A14, class A15, class A16>
10728template <class TYPE>
10729inline
10730Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10731 A15, A16>::
10732#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10733Variant16(TYPE&& value,
10734 typename bsl::enable_if<
10735 !bsl::is_same<
10736 SelfType,
10737 typename bsl::remove_const<
10738 typename bsl::remove_reference<TYPE>::type>::type>::value,
10739 bslma::Allocator>::type *basicAllocator)
10740: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
10741#else
10742Variant16(bslmf::MovableRef<TYPE> value,
10743 bslma::Allocator *basicAllocator)
10744: Imp(MoveUtil::move(value), basicAllocator)
10745#endif
10746{
10747}
10748
10749template <class A1, class A2, class A3, class A4, class A5, class A6,
10750 class A7, class A8, class A9, class A10, class A11, class A12,
10751 class A13, class A14, class A15, class A16>
10752inline
10753Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10754 A15, A16>::
10755Variant16(const Variant16& original, bslma::Allocator *basicAllocator)
10756: Imp(static_cast<const Imp&>(original), basicAllocator)
10757{
10758}
10759
10760template <class A1, class A2, class A3, class A4, class A5, class A6,
10761 class A7, class A8, class A9, class A10, class A11, class A12,
10762 class A13, class A14, class A15, class A16>
10763inline
10764Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10765 A15, A16>::
10766Variant16(bslmf::MovableRef<Variant16> original)
10767: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
10768{
10769}
10770
10771template <class A1, class A2, class A3, class A4, class A5, class A6,
10772 class A7, class A8, class A9, class A10, class A11, class A12,
10773 class A13, class A14, class A15, class A16>
10774inline
10775Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10776 A15, A16>::
10777Variant16(bslmf::MovableRef<Variant16> original,
10778 bslma::Allocator *basicAllocator)
10779: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
10780 basicAllocator)
10781{
10782}
10783
10784// MANIPULATORS
10785template <class A1, class A2, class A3, class A4, class A5, class A6,
10786 class A7, class A8, class A9, class A10, class A11, class A12,
10787 class A13, class A14, class A15, class A16>
10788template <class TYPE>
10789inline
10790Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10791 A15, A16>&
10792Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10793 A15, A16>::
10794operator=(const TYPE& value)
10795{
10796 Imp::operator=(value);
10797 return *this;
10798}
10799
10800template <class A1, class A2, class A3, class A4, class A5, class A6,
10801 class A7, class A8, class A9, class A10, class A11, class A12,
10802 class A13, class A14, class A15, class A16>
10803template <class TYPE>
10804inline
10805#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10806typename bsl::enable_if<
10807 !bsl::is_same<Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11,
10808 A12, A13, A14, A15, A16>,
10809 typename bsl::remove_cvref<TYPE>::type>::value,
10810Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
10811 A16> >::type&
10812Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
10813 A16>::operator=(TYPE&& value)
10814#else
10815Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
10816 A16>&
10817Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
10818 A16>::operator=(bslmf::MovableRef<TYPE> value)
10819#endif
10820{
10821#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10822 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
10823#else
10824 TYPE& lvalue = value;
10825 Imp::operator=(MoveUtil::move(lvalue));
10826#endif
10827
10828 return *this;
10829}
10830
10831template <class A1, class A2, class A3, class A4, class A5, class A6,
10832 class A7, class A8, class A9, class A10, class A11, class A12,
10833 class A13, class A14, class A15, class A16>
10834inline
10835Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10836 A15, A16>&
10837Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10838 A15, A16>::
10839operator=(const Variant16& rhs)
10840{
10841 Imp::operator=(static_cast<const Imp&>(rhs));
10842 return *this;
10843}
10844
10845template <class A1, class A2, class A3, class A4, class A5, class A6,
10846 class A7, class A8, class A9, class A10, class A11, class A12,
10847 class A13, class A14, class A15, class A16>
10848inline
10849Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10850 A15, A16>&
10851Variant16<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10852 A15, A16>::
10853operator=(bslmf::MovableRef<Variant16> rhs)
10854{
10855 Variant16& lvalue = rhs;
10856
10857 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
10858 return *this;
10859}
10860
10861 // --------------------
10862 // class Variant17<...>
10863 // --------------------
10864
10865// CREATORS
10866template <class A1, class A2, class A3, class A4, class A5, class A6,
10867 class A7, class A8, class A9, class A10, class A11, class A12,
10868 class A13, class A14, class A15, class A16, class A17>
10869inline
10870Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10871 A15, A16, A17>::
10872Variant17()
10873{
10874}
10875
10876template <class A1, class A2, class A3, class A4, class A5, class A6,
10877 class A7, class A8, class A9, class A10, class A11, class A12,
10878 class A13, class A14, class A15, class A16, class A17>
10879template <class TYPE_OR_ALLOCATOR>
10880inline
10881Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10882 A15, A16, A17>::
10883Variant17(const TYPE_OR_ALLOCATOR& valueOrAllocator)
10884: Imp(valueOrAllocator)
10885{
10886}
10887
10888template <class A1, class A2, class A3, class A4, class A5, class A6,
10889 class A7, class A8, class A9, class A10, class A11, class A12,
10890 class A13, class A14, class A15, class A16, class A17>
10891template <class TYPE>
10892inline
10893Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10894 A15, A16, A17>::
10895Variant17(const TYPE& value, bslma::Allocator *basicAllocator)
10896: Imp(value, basicAllocator)
10897{
10898}
10899
10900template <class A1, class A2, class A3, class A4, class A5, class A6,
10901 class A7, class A8, class A9, class A10, class A11, class A12,
10902 class A13, class A14, class A15, class A16, class A17>
10903template <class TYPE>
10904inline
10905Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10906 A15, A16, A17>::
10907#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10908Variant17(TYPE&& value,
10909 typename bsl::enable_if<
10910 !bsl::is_same<
10911 SelfType,
10912 typename bsl::remove_const<
10913 typename bsl::remove_reference<TYPE>::type>::type>::value
10914 &&
10916 void>::type *)
10917: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
10918#else
10919Variant17(bslmf::MovableRef<TYPE> value)
10920: Imp(MoveUtil::move(value))
10921#endif
10922{
10923}
10924
10925template <class A1, class A2, class A3, class A4, class A5, class A6,
10926 class A7, class A8, class A9, class A10, class A11, class A12,
10927 class A13, class A14, class A15, class A16, class A17>
10928template <class TYPE>
10929inline
10930Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10931 A15, A16, A17>::
10932#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
10933Variant17(TYPE&& value,
10934 typename bsl::enable_if<
10935 !bsl::is_same<
10936 SelfType,
10937 typename bsl::remove_const<
10938 typename bsl::remove_reference<TYPE>::type>::type>::value,
10939 bslma::Allocator>::type *basicAllocator)
10940: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
10941#else
10942Variant17(bslmf::MovableRef<TYPE> value,
10943 bslma::Allocator *basicAllocator)
10944: Imp(MoveUtil::move(value), basicAllocator)
10945#endif
10946{
10947}
10948
10949template <class A1, class A2, class A3, class A4, class A5, class A6,
10950 class A7, class A8, class A9, class A10, class A11, class A12,
10951 class A13, class A14, class A15, class A16, class A17>
10952inline
10953Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10954 A15, A16, A17>::
10955Variant17(const Variant17& original, bslma::Allocator *basicAllocator)
10956: Imp(static_cast<const Imp&>(original), basicAllocator)
10957{
10958}
10959
10960template <class A1, class A2, class A3, class A4, class A5, class A6,
10961 class A7, class A8, class A9, class A10, class A11, class A12,
10962 class A13, class A14, class A15, class A16, class A17>
10963inline
10964Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10965 A15, A16, A17>::
10966Variant17(bslmf::MovableRef<Variant17> original)
10967: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
10968{
10969}
10970
10971template <class A1, class A2, class A3, class A4, class A5, class A6,
10972 class A7, class A8, class A9, class A10, class A11, class A12,
10973 class A13, class A14, class A15, class A16, class A17>
10974inline
10975Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10976 A15, A16, A17>::
10977Variant17(bslmf::MovableRef<Variant17> original,
10978 bslma::Allocator *basicAllocator)
10979: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
10980 basicAllocator)
10981{
10982}
10983
10984// MANIPULATORS
10985template <class A1, class A2, class A3, class A4, class A5, class A6,
10986 class A7, class A8, class A9, class A10, class A11, class A12,
10987 class A13, class A14, class A15, class A16, class A17>
10988template <class TYPE>
10989inline
10990Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10991 A15, A16, A17>&
10992Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
10993 A15, A16, A17>::
10994operator=(const TYPE& value)
10995{
10996 Imp::operator=(value);
10997 return *this;
10998}
10999
11000template <class A1, class A2, class A3, class A4, class A5, class A6,
11001 class A7, class A8, class A9, class A10, class A11, class A12,
11002 class A13, class A14, class A15, class A16, class A17>
11003template <class TYPE>
11004inline
11005#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11006typename bsl::enable_if<
11007 !bsl::is_same<Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11,
11008 A12, A13, A14, A15, A16, A17>,
11009 typename bsl::remove_cvref<TYPE>::type>::value,
11010Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11011 A16, A17> >::type&
11012Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11013 A16, A17>::operator=(TYPE&& value)
11014#else
11015Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11016 A16, A17>&
11017Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11018 A16, A17>::operator=(bslmf::MovableRef<TYPE> value)
11019#endif
11020{
11021#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11022 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
11023#else
11024 TYPE& lvalue = value;
11025 Imp::operator=(MoveUtil::move(lvalue));
11026#endif
11027
11028 return *this;
11029}
11030
11031template <class A1, class A2, class A3, class A4, class A5, class A6,
11032 class A7, class A8, class A9, class A10, class A11, class A12,
11033 class A13, class A14, class A15, class A16, class A17>
11034inline
11035Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11036 A15, A16, A17>&
11037Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11038 A15, A16, A17>::
11039operator=(const Variant17& rhs)
11040{
11041 Imp::operator=(static_cast<const Imp&>(rhs));
11042 return *this;
11043}
11044
11045template <class A1, class A2, class A3, class A4, class A5, class A6,
11046 class A7, class A8, class A9, class A10, class A11, class A12,
11047 class A13, class A14, class A15, class A16, class A17>
11048inline
11049Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11050 A15, A16, A17>&
11051Variant17<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11052 A15, A16, A17>::
11053operator=(bslmf::MovableRef<Variant17> rhs)
11054{
11055 Variant17& lvalue = rhs;
11056
11057 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
11058 return *this;
11059}
11060
11061 // --------------------
11062 // class Variant18<...>
11063 // --------------------
11064
11065// CREATORS
11066template <class A1, class A2, class A3, class A4, class A5, class A6,
11067 class A7, class A8, class A9, class A10, class A11, class A12,
11068 class A13, class A14, class A15, class A16, class A17, class A18>
11069inline
11070Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11071 A15, A16, A17, A18>::
11072Variant18()
11073{
11074}
11075
11076template <class A1, class A2, class A3, class A4, class A5, class A6,
11077 class A7, class A8, class A9, class A10, class A11, class A12,
11078 class A13, class A14, class A15, class A16, class A17, class A18>
11079template <class TYPE_OR_ALLOCATOR>
11080inline
11081Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11082 A15, A16, A17, A18>::
11083Variant18(const TYPE_OR_ALLOCATOR& valueOrAllocator)
11084: Imp(valueOrAllocator)
11085{
11086}
11087
11088template <class A1, class A2, class A3, class A4, class A5, class A6,
11089 class A7, class A8, class A9, class A10, class A11, class A12,
11090 class A13, class A14, class A15, class A16, class A17, class A18>
11091template <class TYPE>
11092inline
11093Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11094 A15, A16, A17, A18>::
11095Variant18(const TYPE& value, bslma::Allocator *basicAllocator)
11096: Imp(value, basicAllocator)
11097{
11098}
11099
11100template <class A1, class A2, class A3, class A4, class A5, class A6,
11101 class A7, class A8, class A9, class A10, class A11, class A12,
11102 class A13, class A14, class A15, class A16, class A17, class A18>
11103template <class TYPE>
11104inline
11105Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11106 A15, A16, A17, A18>::
11107#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11108Variant18(TYPE&& value,
11109 typename bsl::enable_if<
11110 !bsl::is_same<
11111 SelfType,
11112 typename bsl::remove_const<
11113 typename bsl::remove_reference<TYPE>::type>::type>::value
11114 &&
11116 void>::type *)
11117: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
11118#else
11119Variant18(bslmf::MovableRef<TYPE> value)
11120: Imp(MoveUtil::move(value))
11121#endif
11122{
11123}
11124
11125template <class A1, class A2, class A3, class A4, class A5, class A6,
11126 class A7, class A8, class A9, class A10, class A11, class A12,
11127 class A13, class A14, class A15, class A16, class A17, class A18>
11128template <class TYPE>
11129inline
11130Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11131 A15, A16, A17, A18>::
11132#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11133Variant18(TYPE&& value,
11134 typename bsl::enable_if<
11135 !bsl::is_same<
11136 SelfType,
11137 typename bsl::remove_const<
11138 typename bsl::remove_reference<TYPE>::type>::type>::value,
11139 bslma::Allocator>::type *basicAllocator)
11140: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
11141#else
11142Variant18(bslmf::MovableRef<TYPE> value,
11143 bslma::Allocator *basicAllocator)
11144: Imp(MoveUtil::move(value), basicAllocator)
11145#endif
11146{
11147}
11148
11149template <class A1, class A2, class A3, class A4, class A5, class A6,
11150 class A7, class A8, class A9, class A10, class A11, class A12,
11151 class A13, class A14, class A15, class A16, class A17, class A18>
11152inline
11153Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11154 A15, A16, A17, A18>::
11155Variant18(const Variant18& original, bslma::Allocator *basicAllocator)
11156: Imp(static_cast<const Imp&>(original), basicAllocator)
11157{
11158}
11159
11160template <class A1, class A2, class A3, class A4, class A5, class A6,
11161 class A7, class A8, class A9, class A10, class A11, class A12,
11162 class A13, class A14, class A15, class A16, class A17, class A18>
11163inline
11164Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11165 A15, A16, A17, A18>::
11166Variant18(bslmf::MovableRef<Variant18> original)
11167: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
11168{
11169}
11170
11171template <class A1, class A2, class A3, class A4, class A5, class A6,
11172 class A7, class A8, class A9, class A10, class A11, class A12,
11173 class A13, class A14, class A15, class A16, class A17, class A18>
11174inline
11175Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11176 A15, A16, A17, A18>::
11177Variant18(bslmf::MovableRef<Variant18> original,
11178 bslma::Allocator *basicAllocator)
11179: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
11180 basicAllocator)
11181{
11182}
11183
11184// MANIPULATORS
11185template <class A1, class A2, class A3, class A4, class A5, class A6,
11186 class A7, class A8, class A9, class A10, class A11, class A12,
11187 class A13, class A14, class A15, class A16, class A17, class A18>
11188template <class TYPE>
11189inline
11190Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11191 A15, A16, A17, A18>&
11192Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11193 A15, A16, A17, A18>::
11194operator=(const TYPE& value)
11195{
11196 Imp::operator=(value);
11197 return *this;
11198}
11199
11200template <class A1, class A2, class A3, class A4, class A5, class A6,
11201 class A7, class A8, class A9, class A10, class A11, class A12,
11202 class A13, class A14, class A15, class A16, class A17, class A18>
11203template <class TYPE>
11204inline
11205#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11206typename bsl::enable_if<
11207 !bsl::is_same<Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
11208 A11, A12, A13, A14, A15, A16, A17, A18>,
11209 typename bsl::remove_cvref<TYPE>::type>::value,
11210Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11211 A16, A17, A18> >::type&
11212Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11213 A16, A17, A18>::operator=(TYPE&& value)
11214#else
11215Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11216 A16, A17, A18>&
11217Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11218 A16, A17, A18>::operator=(bslmf::MovableRef<TYPE> value)
11219#endif
11220{
11221#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11222 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
11223#else
11224 TYPE& lvalue = value;
11225 Imp::operator=(MoveUtil::move(lvalue));
11226#endif
11227
11228 return *this;
11229}
11230
11231template <class A1, class A2, class A3, class A4, class A5, class A6,
11232 class A7, class A8, class A9, class A10, class A11, class A12,
11233 class A13, class A14, class A15, class A16, class A17, class A18>
11234inline
11235Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11236 A15, A16, A17, A18>&
11237Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11238 A15, A16, A17, A18>::
11239operator=(const Variant18& rhs)
11240{
11241 Imp::operator=(static_cast<const Imp&>(rhs));
11242 return *this;
11243}
11244
11245template <class A1, class A2, class A3, class A4, class A5, class A6,
11246 class A7, class A8, class A9, class A10, class A11, class A12,
11247 class A13, class A14, class A15, class A16, class A17, class A18>
11248inline
11249Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11250 A15, A16, A17, A18>&
11251Variant18<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11252 A15, A16, A17, A18>::
11253operator=(bslmf::MovableRef<Variant18> rhs)
11254{
11255 Variant18& lvalue = rhs;
11256
11257 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
11258 return *this;
11259}
11260
11261 // --------------------
11262 // class Variant19<...>
11263 // --------------------
11264
11265// CREATORS
11266template <class A1, class A2, class A3, class A4, class A5, class A6,
11267 class A7, class A8, class A9, class A10, class A11, class A12,
11268 class A13, class A14, class A15, class A16, class A17, class A18,
11269 class A19>
11270inline
11271Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11272 A15, A16, A17, A18, A19>::
11273Variant19()
11274{
11275}
11276
11277template <class A1, class A2, class A3, class A4, class A5, class A6,
11278 class A7, class A8, class A9, class A10, class A11, class A12,
11279 class A13, class A14, class A15, class A16, class A17, class A18,
11280 class A19>
11281template <class TYPE_OR_ALLOCATOR>
11282inline
11283Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11284 A15, A16, A17, A18, A19>::
11285Variant19(const TYPE_OR_ALLOCATOR& valueOrAllocator)
11286: Imp(valueOrAllocator)
11287{
11288}
11289
11290template <class A1, class A2, class A3, class A4, class A5, class A6,
11291 class A7, class A8, class A9, class A10, class A11, class A12,
11292 class A13, class A14, class A15, class A16, class A17, class A18,
11293 class A19>
11294template <class TYPE>
11295inline
11296Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11297 A15, A16, A17, A18, A19>::
11298Variant19(const TYPE& value, bslma::Allocator *basicAllocator)
11299: Imp(value, basicAllocator)
11300{
11301}
11302
11303template <class A1, class A2, class A3, class A4, class A5, class A6,
11304 class A7, class A8, class A9, class A10, class A11, class A12,
11305 class A13, class A14, class A15, class A16, class A17, class A18,
11306 class A19>
11307template <class TYPE>
11308inline
11309Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11310 A15, A16, A17, A18, A19>::
11311#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11312Variant19(TYPE&& value,
11313 typename bsl::enable_if<
11314 !bsl::is_same<
11315 SelfType,
11316 typename bsl::remove_const<
11317 typename bsl::remove_reference<TYPE>::type>::type>::value
11318 &&
11320 void>::type *)
11321: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value))
11322#else
11323Variant19(bslmf::MovableRef<TYPE> value)
11324: Imp(MoveUtil::move(value))
11325#endif
11326{
11327}
11328
11329template <class A1, class A2, class A3, class A4, class A5, class A6,
11330 class A7, class A8, class A9, class A10, class A11, class A12,
11331 class A13, class A14, class A15, class A16, class A17, class A18,
11332 class A19>
11333template <class TYPE>
11334inline
11335Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11336 A15, A16, A17, A18, A19>::
11337#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11338Variant19(TYPE&& value,
11339 typename bsl::enable_if<
11340 !bsl::is_same<
11341 SelfType,
11342 typename bsl::remove_const<
11343 typename bsl::remove_reference<TYPE>::type>::type>::value,
11344 bslma::Allocator>::type *basicAllocator)
11345: Imp(BSLS_COMPILERFEATURES_FORWARD(TYPE, value), basicAllocator)
11346#else
11347Variant19(bslmf::MovableRef<TYPE> value,
11348 bslma::Allocator *basicAllocator)
11349: Imp(MoveUtil::move(value), basicAllocator)
11350#endif
11351{
11352}
11353
11354template <class A1, class A2, class A3, class A4, class A5, class A6,
11355 class A7, class A8, class A9, class A10, class A11, class A12,
11356 class A13, class A14, class A15, class A16, class A17, class A18,
11357 class A19>
11358inline
11359Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11360 A15, A16, A17, A18, A19>::
11361Variant19(const Variant19& original, bslma::Allocator *basicAllocator)
11362: Imp(static_cast<const Imp&>(original), basicAllocator)
11363{
11364}
11365
11366template <class A1, class A2, class A3, class A4, class A5, class A6,
11367 class A7, class A8, class A9, class A10, class A11, class A12,
11368 class A13, class A14, class A15, class A16, class A17, class A18,
11369 class A19>
11370inline
11371Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11372 A15, A16, A17, A18, A19>::
11373Variant19(bslmf::MovableRef<Variant19> original)
11374: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))))
11375{
11376}
11377
11378template <class A1, class A2, class A3, class A4, class A5, class A6,
11379 class A7, class A8, class A9, class A10, class A11, class A12,
11380 class A13, class A14, class A15, class A16, class A17, class A18,
11381 class A19>
11382inline
11383Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11384 A15, A16, A17, A18, A19>::
11385Variant19(bslmf::MovableRef<Variant19> original,
11386 bslma::Allocator *basicAllocator)
11387: Imp(MoveUtil::move(static_cast<Imp&>(MoveUtil::access(original))),
11388 basicAllocator)
11389{
11390}
11391
11392// MANIPULATORS
11393template <class A1, class A2, class A3, class A4, class A5, class A6,
11394 class A7, class A8, class A9, class A10, class A11, class A12,
11395 class A13, class A14, class A15, class A16, class A17, class A18,
11396 class A19>
11397template <class TYPE>
11398inline
11399Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11400 A15, A16, A17, A18, A19>&
11401Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11402 A15, A16, A17, A18, A19>::
11403operator=(const TYPE& value)
11404{
11405 Imp::operator=(value);
11406 return *this;
11407}
11408
11409template <class A1, class A2, class A3, class A4, class A5, class A6,
11410 class A7, class A8, class A9, class A10, class A11, class A12,
11411 class A13, class A14, class A15, class A16, class A17, class A18,
11412 class A19>
11413template <class TYPE>
11414inline
11415#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11416typename bsl::enable_if<
11417 !bsl::is_same<Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
11418 A11, A12, A13, A14, A15, A16, A17, A18, A19>,
11419 typename bsl::remove_cvref<TYPE>::type>::value,
11420Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11421 A16, A17, A18, A19> >::type&
11422Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11423 A16, A17, A18, A19>::operator=(TYPE&& value)
11424#else
11425Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11426 A16, A17, A18, A19>&
11427Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15,
11428 A16, A17, A18, A19>::operator=(bslmf::MovableRef<TYPE> value)
11429#endif
11430{
11431#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
11432 Imp::operator=(BSLS_COMPILERFEATURES_FORWARD(TYPE, value));
11433#else
11434 TYPE& lvalue = value;
11435 Imp::operator=(MoveUtil::move(lvalue));
11436#endif
11437
11438 return *this;
11439}
11440
11441template <class A1, class A2, class A3, class A4, class A5, class A6,
11442 class A7, class A8, class A9, class A10, class A11, class A12,
11443 class A13, class A14, class A15, class A16, class A17, class A18,
11444 class A19>
11445inline
11446Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11447 A15, A16, A17, A18, A19>&
11448Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11449 A15, A16, A17, A18, A19>::
11450operator=(const Variant19& rhs)
11451{
11452 Imp::operator=(static_cast<const Imp&>(rhs));
11453 return *this;
11454}
11455
11456template <class A1, class A2, class A3, class A4, class A5, class A6,
11457 class A7, class A8, class A9, class A10, class A11, class A12,
11458 class A13, class A14, class A15, class A16, class A17, class A18,
11459 class A19>
11460inline
11461Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11462 A15, A16, A17, A18, A19>&
11463Variant19<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14,
11464 A15, A16, A17, A18, A19>::
11465operator=(bslmf::MovableRef<Variant19> rhs)
11466{
11467 Variant19& lvalue = rhs;
11468
11469 Imp::operator=(MoveUtil::move(static_cast<Imp&>(lvalue)));
11470 return *this;
11471}
11472
11473} // close package namespace
11474
11475
11476#else // if ! defined(DEFINED_BDLB_VARIANT_H)
11477# error Not valid except when included from bdlb_variant.h
11478#endif // ! defined(COMPILING_BDLB_VARIANT_H)
11479
11480#endif // ! defined(INCLUDED_BDLB_VARIANT_CPP03)
11481
11482// ----------------------------------------------------------------------------
11483// Copyright 2015 Bloomberg Finance L.P.
11484//
11485// Licensed under the Apache License, Version 2.0 (the "License");
11486// you may not use this file except in compliance with the License.
11487// You may obtain a copy of the License at
11488//
11489// http://www.apache.org/licenses/LICENSE-2.0
11490//
11491// Unless required by applicable law or agreed to in writing, software
11492// distributed under the License is distributed on an "AS IS" BASIS,
11493// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11494// See the License for the specific language governing permissions and
11495// limitations under the License.
11496// ----------------------------- END-OF-FILE ----------------------------------
11497
11498/** @} */
11499/** @} */
11500/** @} */
#define BSLMF_NESTED_TRAIT_DECLARATION(t_TYPE, t_TRAIT)
Definition bslmf_nestedtraitdeclaration.h:231
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
TYPES TypeList
Definition bdlb_variant.h:823
bslmf::TypeListTypeOf< 20, TYPES >::TypeOrDefault Type20
Definition bdlb_variant.h:848
bslmf::TypeListTypeOf< 10, TYPES >::TypeOrDefault Type10
Definition bdlb_variant.h:834
bslmf::TypeListTypeOf< 2, TYPES >::TypeOrDefault Type2
Definition bdlb_variant.h:826
bslmf::TypeListTypeOf< 8, TYPES >::TypeOrDefault Type8
Definition bdlb_variant.h:832
bslmf::TypeListTypeOf< 15, TYPES >::TypeOrDefault Type15
Definition bdlb_variant.h:839
bslmf::TypeListTypeOf< 14, TYPES >::TypeOrDefault Type14
Definition bdlb_variant.h:838
bslmf::TypeListTypeOf< 9, TYPES >::TypeOrDefault Type9
Definition bdlb_variant.h:833
friend class VariantImp
Definition bdlb_variant.h:888
bslmf::TypeListTypeOf< 4, TYPES >::TypeOrDefault Type4
Definition bdlb_variant.h:828
bslmf::TypeListTypeOf< 7, TYPES >::TypeOrDefault Type7
Definition bdlb_variant.h:831
friend bool operator==(const VariantImp< VARIANT_TYPES > &, const VariantImp< VARIANT_TYPES > &)
bslmf::TypeListTypeOf< 6, TYPES >::TypeOrDefault Type6
Definition bdlb_variant.h:830
bslmf::TypeListTypeOf< 12, TYPES >::TypeOrDefault Type12
Definition bdlb_variant.h:836
bslmf::TypeListTypeOf< 11, TYPES >::TypeOrDefault Type11
Definition bdlb_variant.h:835
bslmf::TypeListTypeOf< 5, TYPES >::TypeOrDefault Type5
Definition bdlb_variant.h:829
bslmf::TypeListTypeOf< 16, TYPES >::TypeOrDefault Type16
Definition bdlb_variant.h:840
bslmf::TypeListTypeOf< 13, TYPES >::TypeOrDefault Type13
Definition bdlb_variant.h:837
bslma::Allocator * getAllocator() const
Return the allocator used by this object to supply memory.
Definition bdlb_variant.h:6387
bslmf::TypeListTypeOf< 18, TYPES >::TypeOrDefault Type18
Definition bdlb_variant.h:842
bslmf::TypeListTypeOf< 3, TYPES >::TypeOrDefault Type3
Definition bdlb_variant.h:827
bslmf::TypeListTypeOf< 19, TYPES >::TypeOrDefault Type19
Definition bdlb_variant.h:843
bslmf::TypeListTypeOf< 1, TYPES >::TypeOrDefault Type1
Definition bdlb_variant.h:825
VariantImp_AllocatorBase(int type, bslma::Allocator *basicAllocator)
Definition bdlb_variant.h:6358
bslmf::TypeListTypeOf< 17, TYPES >::TypeOrDefault Type17
Definition bdlb_variant.h:841
bslma::Allocator * getAllocator() const
Return 0. Note that this object does not hold an allocator pointer.
Definition bdlb_variant.h:6426
bslmf::TypeListTypeOf< 17, TYPES >::TypeOrDefault Type17
Definition bdlb_variant.h:956
friend class VariantImp
Definition bdlb_variant.h:998
bslmf::TypeListTypeOf< 6, TYPES >::TypeOrDefault Type6
Definition bdlb_variant.h:945
bslmf::TypeListTypeOf< 4, TYPES >::TypeOrDefault Type4
Definition bdlb_variant.h:943
friend bool operator==(const VariantImp< VARIANT_TYPES > &, const VariantImp< VARIANT_TYPES > &)
bslmf::TypeListTypeOf< 8, TYPES >::TypeOrDefault Type8
Definition bdlb_variant.h:947
bslmf::TypeListTypeOf< 14, TYPES >::TypeOrDefault Type14
Definition bdlb_variant.h:953
bslmf::TypeListTypeOf< 1, TYPES >::TypeOrDefault Type1
Definition bdlb_variant.h:940
bslmf::TypeListTypeOf< 18, TYPES >::TypeOrDefault Type18
Definition bdlb_variant.h:957
bslmf::TypeListTypeOf< 10, TYPES >::TypeOrDefault Type10
Definition bdlb_variant.h:949
bslmf::TypeListTypeOf< 15, TYPES >::TypeOrDefault Type15
Definition bdlb_variant.h:954
bslmf::TypeListTypeOf< 2, TYPES >::TypeOrDefault Type2
Definition bdlb_variant.h:941
bslmf::TypeListTypeOf< 20, TYPES >::TypeOrDefault Type20
Definition bdlb_variant.h:963
bslmf::TypeListTypeOf< 7, TYPES >::TypeOrDefault Type7
Definition bdlb_variant.h:946
bslmf::TypeListTypeOf< 16, TYPES >::TypeOrDefault Type16
Definition bdlb_variant.h:955
bslmf::TypeListTypeOf< 12, TYPES >::TypeOrDefault Type12
Definition bdlb_variant.h:951
bslmf::TypeListTypeOf< 19, TYPES >::TypeOrDefault Type19
Definition bdlb_variant.h:958
bslmf::TypeListTypeOf< 3, TYPES >::TypeOrDefault Type3
Definition bdlb_variant.h:942
bslmf::TypeListTypeOf< 9, TYPES >::TypeOrDefault Type9
Definition bdlb_variant.h:948
TYPES TypeList
Definition bdlb_variant.h:938
bslmf::TypeListTypeOf< 13, TYPES >::TypeOrDefault Type13
Definition bdlb_variant.h:952
bslmf::TypeListTypeOf< 11, TYPES >::TypeOrDefault Type11
Definition bdlb_variant.h:950
bslmf::TypeListTypeOf< 5, TYPES >::TypeOrDefault Type5
Definition bdlb_variant.h:944
VariantImp_NoAllocatorBase(int type, bslma::Allocator *)
Definition bdlb_variant.h:6400
void reset()
Definition bdlb_variant.h:7472
STREAM & bdexStreamIn(STREAM &stream, int version)
DEPRECATED: Do not use.
Definition bdlb_variant.h:7661
bool is() const
Definition bdlb_variant.h:7605
~VariantImp()
Definition bdlb_variant.h:7216
int typeIndex() const
Definition bdlb_variant.h:7646
VariantImp()
Definition bdlb_variant.h:7058
const bsl::type_info & typeInfo() const
Definition bdlb_variant.h:7654
bsl::enable_if< Variant_ReturnValueHelper< VISITOR >::value==1, typenameVISITOR::ResultType >::type apply(VISITOR &visitor)
Definition bdlb_variant.h:1517
TYPE & createInPlace(ARGS &&... arguments)
Definition bdlb_variant.h:7454
VariantImp & operator=(const TYPE &value)
STREAM & bdexStreamOut(STREAM &stream, int version) const
DEPRECATED: Do not use.
Definition bdlb_variant.h:7699
bsl::enable_if< Variant_ReturnValueHelper< VISITOR >::value==1, typenameVISITOR::ResultType >::type applyRaw(VISITOR &visitor)
Definition bdlb_variant.h:1736
int maxSupportedBdexVersion() const
DEPRECATED: Do not use.
Definition bdlb_variant.h:7692
bool isUnset() const
Definition bdlb_variant.h:7612
TYPE & the()
Definition bdlb_variant.h:7517
VariantImp & assign(const TYPE &value)
void swap(VariantImp &other)
Definition bdlb_variant.h:7482
VariantImp & assignTo(const SOURCE_TYPE &value)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlb_variant.h:7619
RESULT_TYPE operator()(ARGUMENT_TYPE &argument)
Definition bdlb_variant.h:6450
Variant_RawVisitorHelper(VISITOR *visitor)
Definition bdlb_variant.h:6439
Variant & operator=(const TYPE &value)
Variant()
Definition bdlb_variant.h:7923
static void swap(T *a, T *b)
Definition bslalg_swaputil.h:194
Definition bslma_allocator.h:457
Definition bslmf_movableref.h:751
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:1895
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
void reset(TYPE *object)
Reset the value of the specified object to its default value.
int assign(LHS_TYPE *lhs, const RHS_TYPE &rhs)
Definition bdlb_algorithmworkaroundutil.h:74
bool operator!=(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
char Variant_ReturnValueHelper_YesType
Definition bdlb_variant.h:770
bsl::ostream & operator<<(bsl::ostream &stream, const BigEndianInt16 &integer)
void swap(NullableAllocatedValue< TYPE > &a, NullableAllocatedValue< TYPE > &b)
bool operator==(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
Definition bdlb_printmethods.h:283
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1247
STREAM & bdexStreamOut(STREAM &stream, const TYPE &value)
Definition bslx_outstreamfunctions.h:992
bslmf::TypeListTypeOf< 14, TYPES >::TypeOrDefault Type14
Definition bdlb_variant.h:1047
bsl::conditional< k_VARIANT_USES_BSLMA_ALLOCATOR, VariantImp_AllocatorBase< TYPES >, VariantImp_NoAllocatorBase< TYPES > >::type BaseType
Determines what the base type is.
Definition bdlb_variant.h:1132
bslmf::TypeListTypeOf< 7, TYPES >::TypeOrDefault Type7
Definition bdlb_variant.h:1040
bslmf::TypeListTypeOf< 12, TYPES >::TypeOrDefault Type12
Definition bdlb_variant.h:1045
bslmf::TypeListTypeOf< 18, TYPES >::TypeOrDefault Type18
Definition bdlb_variant.h:1051
bslmf::TypeListTypeOf< 6, TYPES >::TypeOrDefault Type6
Definition bdlb_variant.h:1039
bslmf::TypeListTypeOf< 13, TYPES >::TypeOrDefault Type13
Definition bdlb_variant.h:1046
bslmf::TypeListTypeOf< 19, TYPES >::TypeOrDefault Type19
Definition bdlb_variant.h:1052
bslmf::TypeListTypeOf< 17, TYPES >::TypeOrDefault Type17
Definition bdlb_variant.h:1050
bslmf::TypeListTypeOf< 3, TYPES >::TypeOrDefault Type3
Definition bdlb_variant.h:1036
bslmf::TypeListTypeOf< 11, TYPES >::TypeOrDefault Type11
Definition bdlb_variant.h:1044
@ VARIANT_USES_BSLMA_ALLOCATOR
Definition bdlb_variant.h:1122
@ VARIANT_IS_BITWISE_COPYABLE
Definition bdlb_variant.h:1123
@ k_VARIANT_IS_BITWISE_MOVEABLE
Definition bdlb_variant.h:1100
@ VARIANT_IS_BITWISE_MOVEABLE
Definition bdlb_variant.h:1124
@ k_VARIANT_USES_BSLMA_ALLOCATOR
Definition bdlb_variant.h:1056
@ k_VARIANT_IS_BITWISE_COPYABLE
Definition bdlb_variant.h:1078
bslmf::TypeListTypeOf< 1, TYPES >::TypeOrDefault Type1
Definition bdlb_variant.h:1034
bslmf::TypeListTypeOf< 8, TYPES >::TypeOrDefault Type8
Definition bdlb_variant.h:1041
bslmf::TypeListTypeOf< 2, TYPES >::TypeOrDefault Type2
Definition bdlb_variant.h:1035
bslmf::TypeListTypeOf< 16, TYPES >::TypeOrDefault Type16
Definition bdlb_variant.h:1049
bslmf::TypeListTypeOf< 5, TYPES >::TypeOrDefault Type5
Definition bdlb_variant.h:1038
bslmf::TypeListTypeOf< 20, TYPES >::TypeOrDefault Type20
Definition bdlb_variant.h:1053
bslmf::TypeListTypeOf< 15, TYPES >::TypeOrDefault Type15
Definition bdlb_variant.h:1048
bslmf::TypeListTypeOf< 4, TYPES >::TypeOrDefault Type4
Definition bdlb_variant.h:1037
bslmf::TypeListTypeOf< 9, TYPES >::TypeOrDefault Type9
Definition bdlb_variant.h:1042
bslmf::TypeListTypeOf< 10, TYPES >::TypeOrDefault Type10
Definition bdlb_variant.h:1043
static Variant_ReturnValueHelper_YesType match(typename bsl::remove_reference< typename T::ResultType >::type *)
Definition bslmf_conditional.h:120
Definition bslmf_enableif.h:525
Definition bslmf_integralconstant.h:244
Definition bslmf_isconvertible.h:867
Definition bslmf_issame.h:146
Definition bslmf_removeconst.h:156
bsl::remove_cv< typenamebsl::remove_reference< t_TYPE >::type >::type type
Definition bslmf_removecvref.h:136
static void construct(TARGET_TYPE *address, const ALLOCATOR &allocator)
Definition bslma_constructionutil.h:1243
Definition bslma_usesbslmaallocator.h:343
Definition bslmf_isbitwisecopyable.h:298
Definition bslmf_isbitwisemoveable.h:718
Definition bslmf_movableref.h:791
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1060
This struct is empty and represents a nil type.
Definition bslmf_nil.h:131
Definition bslmf_typelist.h:1856
Definition bslmf_typelist.h:1899
Definition bslmf_typelist.h:1945
Definition bslmf_typelist.h:1994
Definition bslmf_typelist.h:2046
Definition bslmf_typelist.h:2101
Definition bslmf_typelist.h:2159
Definition bslmf_typelist.h:2220
Definition bslmf_typelist.h:2284
Definition bslmf_typelist.h:2351
List of a three types t_A1, t_A2, t_A3 types.
Definition bslmf_typelist.h:1685
Definition bslmf_typelist.h:1703
Definition bslmf_typelist.h:1720
Definition bslmf_typelist.h:1743
Definition bslmf_typelist.h:1768
Definition bslmf_typelist.h:1795
Definition bslmf_typelist.h:1824
Definition bslmf_typelist.h:1609
Definition bsls_objectbuffer.h:276