Quick Links: |
#include <bdlb_variant.h>
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION_IF (VariantImp, bslma::UsesBslmaAllocator, Traits::k_VARIANT_USES_BSLMA_ALLOCATOR) | |
BSLMF_NESTED_TRAIT_DECLARATION_IF (VariantImp, bsl::is_trivially_copyable, Traits::k_VARIANT_IS_BITWISE_COPYABLE) | |
BSLMF_NESTED_TRAIT_DECLARATION_IF (VariantImp, bslmf::IsBitwiseMoveable, Traits::k_VARIANT_IS_BITWISE_MOVEABLE) | |
BSLMF_NESTED_TRAIT_DECLARATION (VariantImp, HasPrintMethod) | |
VariantImp () | |
template<class TYPE_OR_ALLOCATOR > | |
VariantImp (const TYPE_OR_ALLOCATOR &valueOrAllocator) | |
template<class TYPE > | |
VariantImp (const TYPE &value, bslma::Allocator *basicAllocator) | |
template<class TYPE > | |
VariantImp (bslmf::MovableRef< TYPE > value) | |
template<class TYPE > | |
VariantImp (bslmf::MovableRef< TYPE > value, bslma::Allocator *basicAllocator) | |
VariantImp (const VariantImp &original, bslma::Allocator *basicAllocator=0) | |
VariantImp (bslmf::MovableRef< VariantImp > original) | |
VariantImp (bslmf::MovableRef< VariantImp > original, bslma::Allocator *basicAllocator) | |
~VariantImp () | |
template<class TYPE > | |
VariantImp & | operator= (const TYPE &value) |
template<class TYPE > | |
VariantImp & | operator= (bslmf::MovableRef< TYPE > value) |
VariantImp & | operator= (const VariantImp &rhs) |
VariantImp & | operator= (bslmf::MovableRef< VariantImp > rhs) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (VISITOR &visitor) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (const VISITOR &visitor) |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (VISITOR &visitor, const TYPE &defaultValue) |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (const VISITOR &visitor, const TYPE &defaultValue) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (VISITOR &visitor) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (const VISITOR &visitor) |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (VISITOR &visitor, const TYPE &defaultValue) |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (const VISITOR &visitor, const TYPE &defaultValue) |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | apply (VISITOR &visitor) |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | apply (const VISITOR &visitor) |
template<class RET_TYPE , class VISITOR , class TYPE > | |
RET_TYPE | apply (VISITOR &visitor, const TYPE &defaultValue) |
template<class RET_TYPE , class VISITOR , class TYPE > | |
RET_TYPE | apply (const VISITOR &visitor, const TYPE &defaultValue) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | applyRaw (VISITOR &visitor) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | applyRaw (const VISITOR &visitor) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | applyRaw (VISITOR &visitor) |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | applyRaw (const VISITOR &visitor) |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | applyRaw (VISITOR &visitor) |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | applyRaw (const VISITOR &visitor) |
template<class TYPE > | |
VariantImp & | assign (const TYPE &value) |
template<class TYPE > | |
VariantImp & | assign (bslmf::MovableRef< TYPE > value) |
template<class TYPE , class SOURCE_TYPE > | |
VariantImp & | assignTo (const SOURCE_TYPE &value) |
template<class TYPE > | |
TYPE & | createInPlace () |
template<class TYPE , class A1 > | |
TYPE & | createInPlace (const A1 &a1) |
template<class TYPE , class A1 , class A2 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2) |
template<class TYPE , class A1 , class A2 , class A3 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 , class A10 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9, const A10 &a10) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 , class A10 , class A11 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9, const A10 &a10, const A11 &a11) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 , class A10 , class A11 , class A12 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9, const A10 &a10, const A11 &a11, const A12 &a12) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 , class A10 , class A11 , class A12 , class A13 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9, const A10 &a10, const A11 &a11, const A12 &a12, const A13 &a13) |
template<class TYPE , class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 , class A10 , class A11 , class A12 , class A13 , class A14 > | |
TYPE & | createInPlace (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9, const A10 &a10, const A11 &a11, const A12 &a12, const A13 &a13, const A14 &a14) |
void | reset () |
void | swap (VariantImp &other) |
template<class TYPE > | |
TYPE & | the () |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (VISITOR &visitor) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (const VISITOR &visitor) const |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (VISITOR &visitor, const TYPE &defaultValue) const |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | apply (const VISITOR &visitor, const TYPE &defaultValue) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (VISITOR &visitor) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (const VISITOR &visitor) const |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (VISITOR &visitor, const TYPE &defaultValue) const |
template<class VISITOR , class TYPE > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | apply (const VISITOR &visitor, const TYPE &defaultValue) const |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | apply (VISITOR &visitor) const |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | apply (const VISITOR &visitor) const |
template<class RET_TYPE , class VISITOR , class TYPE > | |
RET_TYPE | apply (VISITOR &visitor, const TYPE &defaultValue) const |
template<class RET_TYPE , class VISITOR , class TYPE > | |
RET_TYPE | apply (const VISITOR &visitor, const TYPE &defaultValue) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | applyRaw (VISITOR &visitor) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==1, typename VISITOR::ResultType > ::type | applyRaw (const VISITOR &visitor) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | applyRaw (VISITOR &visitor) const |
template<class VISITOR > | |
bsl::enable_if < Variant_ReturnValueHelper < VISITOR >::value==0, void > ::type | applyRaw (const VISITOR &visitor) const |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | applyRaw (VISITOR &visitor) const |
template<class RET_TYPE , class VISITOR > | |
RET_TYPE | applyRaw (const VISITOR &visitor) const |
template<class TYPE > | |
bool | is () const |
bool | isUnset () const |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
template<class TYPE > | |
const TYPE & | the () const |
int | typeIndex () const |
const bsl::type_info & | typeInfo () const |
template<class STREAM > | |
STREAM & | bdexStreamIn (STREAM &stream, int version) |
int | maxSupportedBdexVersion () const |
template<class STREAM > | |
STREAM & | bdexStreamOut (STREAM &stream, int version) const |
This class provides the implementation of Variant
(except for the creators) given a list of template parameter TYPES
.
More generally, if each of the types in the list of TYPES
is value semantic, then this class also supports a complete set of value semantic operations, including copy construction, assignment, equality comparison, and ostream
printing. A precise operational definition of when two instances have the same value can be found in the description of operator==
for the class. This class is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing instance, the object is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.
If any of the types in the list of TYPES
does not support operator==
, or any of the value-semantic operations mentioned above, then this variant also does not support that operation and attempts to invoke it will trigger a compilation diagnostic.
bdlb::VariantImp< TYPES >::VariantImp | ( | ) |
Create a variant object in the unset state that uses the currently installed default allocator to supply memory.
bdlb::VariantImp< TYPES >::VariantImp | ( | const TYPE_OR_ALLOCATOR & | valueOrAllocator | ) | [explicit] |
Create a variant object with the specified valueOrAllocator
that can be either a value of a type that the variant can hold or an allocator to supply memory. If valueOrAllocator
is not a bslma::Allocator *
, then the variant will hold the value and type of valueOrAllocator
, and use the currently installed default allocator to supply memory. Otherwise, the variant will be unset and use valueOrAllocator
to supply memory. TYPE_OR_ALLOCATOR
must be the same as one of the types that this variant can hold or be convertible to bslma::Allocator *
. Note that this parameterized constructor is defined instead of two constructors (one taking a bslma::Allocator *
and the other not) because template parameter arguments are always a better match than derived-to-base conversion (a concrete allocator pointer converted to bslma::Allocator *
).
bdlb::VariantImp< TYPES >::VariantImp | ( | const TYPE & | value, | |
bslma::Allocator * | basicAllocator | |||
) |
Create a variant object having the specified value
of template parameter TYPE
and that uses the specified basicAllocator
to supply memory. If basicAllocator
is 0, the currently installed default allocator is used. TYPE
must be the same as one of the types that this variant can hold.
bdlb::VariantImp< TYPES >::VariantImp | ( | bslmf::MovableRef< TYPE > | value | ) | [explicit] |
Create a variant object having the specified value
of template parameter TYPE
by moving the contents of value
to the newly-created object. Use the currently installed default allocator to supply memory. value
is left in a valid but unspecified state. TYPE
must be the same as one of the types that this variant can hold. Note that in C++11 mode, this method does not participate in overload resolution if it would lead to ambiguity with the move constructor that does not take an allocator (below) or with the constructor taking a valueOrAllocator
(above).
bdlb::VariantImp< TYPES >::VariantImp | ( | bslmf::MovableRef< TYPE > | value, | |
bslma::Allocator * | basicAllocator | |||
) |
Create a variant object having the specified value
of template parameter TYPE
that uses the specified basicAllocator
to supply memory. If basicAllocator
is 0, the currently installed default allocator is used. The contents of value
are moved to the newly-created object with value
left in a valid but unspecified state. TYPE
must be the same as one of the types that this variant can hold. Note that in C++11 mode, this method does not participate in overload resolution if it would lead to ambiguity with the move constructor that takes an allocator (below).
bdlb::VariantImp< TYPES >::VariantImp | ( | const VariantImp< TYPES > & | original, | |
bslma::Allocator * | basicAllocator = 0 | |||
) |
Create a variant object having the type and value of the specified original
variant. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
bdlb::VariantImp< TYPES >::VariantImp | ( | bslmf::MovableRef< VariantImp< TYPES > > | original | ) |
Create a variant object having the type and value of the specified original
object by moving the contents of original
to the newly-created object. The allocator associated with original
(if any) is propagated for use in the newly-created object. original
is left in a valid but unspecified state.
bdlb::VariantImp< TYPES >::VariantImp | ( | bslmf::MovableRef< VariantImp< TYPES > > | original, | |
bslma::Allocator * | basicAllocator | |||
) |
Create a variant object having the type and value of the specified original
object that uses the specified basicAllocator
to supply memory. If basicAllocator
is 0, the currently installed default allocator is used. The contents of original
are moved to the newly-created object with original
left in a valid but unspecified state.
bdlb::VariantImp< TYPES >::~VariantImp | ( | ) |
Destroy this variant object, invoking the destructor of the type of object contained (if any) on the value of that type.
bdlb::VariantImp< TYPES >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | VariantImp< TYPES > | , | |
bslma::UsesBslmaAllocator | , | |||
Traits::k_VARIANT_USES_BSLMA_ALLOCATOR | ||||
) |
bdlb::VariantImp< TYPES >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | VariantImp< TYPES > | , | |
bsl::is_trivially_copyable | , | |||
Traits::k_VARIANT_IS_BITWISE_COPYABLE | ||||
) |
bdlb::VariantImp< TYPES >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | VariantImp< TYPES > | , | |
bslmf::IsBitwiseMoveable | , | |||
Traits::k_VARIANT_IS_BITWISE_MOVEABLE | ||||
) |
bdlb::VariantImp< TYPES >::BSLMF_NESTED_TRAIT_DECLARATION | ( | VariantImp< TYPES > | , | |
HasPrintMethod | ||||
) |
VariantImp& bdlb::VariantImp< TYPES >::operator= | ( | const TYPE & | value | ) |
Assign to this object the specified value
of template parameter TYPE
, and return a reference providing modifiable access to this object. The value currently held by this variant (if any) is destroyed if that value's type is not the same as TYPE
. TYPE
must be the same as one of the types that this variant can hold.
Reimplemented in bdlb::Variant< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20 >, bdlb::Variant2< A1, A2 >, bdlb::Variant3< A1, A2, A3 >, bdlb::Variant4< A1, A2, A3, A4 >, bdlb::Variant5< A1, A2, A3, A4, A5 >, bdlb::Variant6< A1, A2, A3, A4, A5, A6 >, bdlb::Variant7< A1, A2, A3, A4, A5, A6, A7 >, bdlb::Variant8< A1, A2, A3, A4, A5, A6, A7, A8 >, bdlb::Variant9< A1, A2, A3, A4, A5, A6, A7, A8, A9 >, bdlb::Variant10< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 >, bdlb::Variant11< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11 >, bdlb::Variant12< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12 >, bdlb::Variant13< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13 >, bdlb::Variant14< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14 >, bdlb::Variant15< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15 >, bdlb::Variant16< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16 >, bdlb::Variant17< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 >, bdlb::Variant18< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18 >, bdlb::Variant19< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19 >, bdlb::Variant< bsls::Types::Int64, double, bsl::string, bdlt::DatetimeTz, bsl::vector< char > >, bdlb::Variant< Bool, Char, Int, Int64, Double, String, Datetime, Date, Time, CharArray, IntArray, Int64Array, DoubleArray, StringArray, DatetimeArray, DateArray, TimeArray, OptionValue_NullOf >, bdlb::Variant< JsonObject, JsonArray, bsl::string, JsonNumber, bool, JsonNull >, and bdlb::Variant< int, long, long long, unsigned int, unsigned long, unsigned long long, bsl::string, const void * >.
VariantImp& bdlb::VariantImp< TYPES >::operator= | ( | bslmf::MovableRef< TYPE > | value | ) |
Assign to this object the specified value
of template parameter TYPE
, and return a reference providing modifiable access to this object. The contents of value
are moved to this object with value
left in a valid but unspecified state. The value currently held by this variant (if any) is destroyed if that value's type is not the same as TYPE
. TYPE
must be the same as one of the types that this variant can hold. Note that in C++11 mode, this method does not participate in overload resolution if it would lead to ambiguity with the move-assignment operator (below).
Reimplemented in bdlb::Variant< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20 >, bdlb::Variant2< A1, A2 >, bdlb::Variant3< A1, A2, A3 >, bdlb::Variant4< A1, A2, A3, A4 >, bdlb::Variant5< A1, A2, A3, A4, A5 >, bdlb::Variant6< A1, A2, A3, A4, A5, A6 >, bdlb::Variant7< A1, A2, A3, A4, A5, A6, A7 >, bdlb::Variant8< A1, A2, A3, A4, A5, A6, A7, A8 >, bdlb::Variant9< A1, A2, A3, A4, A5, A6, A7, A8, A9 >, bdlb::Variant10< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 >, bdlb::Variant11< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11 >, bdlb::Variant12< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12 >, bdlb::Variant13< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13 >, bdlb::Variant14< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14 >, bdlb::Variant15< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15 >, bdlb::Variant16< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16 >, bdlb::Variant17< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 >, bdlb::Variant18< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18 >, bdlb::Variant19< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19 >, bdlb::Variant< bsls::Types::Int64, double, bsl::string, bdlt::DatetimeTz, bsl::vector< char > >, bdlb::Variant< Bool, Char, Int, Int64, Double, String, Datetime, Date, Time, CharArray, IntArray, Int64Array, DoubleArray, StringArray, DatetimeArray, DateArray, TimeArray, OptionValue_NullOf >, bdlb::Variant< JsonObject, JsonArray, bsl::string, JsonNumber, bool, JsonNull >, and bdlb::Variant< int, long, long long, unsigned int, unsigned long, unsigned long long, bsl::string, const void * >.
VariantImp& bdlb::VariantImp< TYPES >::operator= | ( | const VariantImp< TYPES > & | rhs | ) |
Assign to this object the type and value currently held by the specified rhs
object, and return a reference providing modifiable access to this object. The value currently held by this variant (if any) is destroyed if that value's type is not the same as the type held by the rhs
object.
VariantImp& bdlb::VariantImp< TYPES >::operator= | ( | bslmf::MovableRef< VariantImp< TYPES > > | rhs | ) |
Assign to this object the type and value currently held by the specified rhs
object, and return a reference providing modifiable access to this object. The contents of rhs
are either move-inserted into or move-assigned to this object with rhs
left in a valid but unspecified state.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor | ) |
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor | ) |
Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
.
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) |
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) |
Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::applyRaw | ( | VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::applyRaw | ( | const VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::applyRaw | ( | VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
. This method does not return a value. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::applyRaw | ( | const VISITOR & | visitor | ) | [inline] |
< Apply the specified visitor
to this modifiable variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
. This method does not return a value. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RET_TYPE bdlb::VariantImp< TYPES >::applyRaw | ( | VISITOR & | visitor | ) |
RET_TYPE bdlb::VariantImp< TYPES >::applyRaw | ( | const VISITOR & | visitor | ) |
Apply the specified visitor
to this modifiable variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. The behavior is undefined if this variant is unset.
VariantImp& bdlb::VariantImp< TYPES >::assign | ( | const TYPE & | value | ) |
Assign to this object the specified value
of template parameter TYPE
, and return a reference providing modifiable access to this object. The value currently held by this variant (if any) is destroyed if that value's type is not the same as TYPE
. TYPE
must be the same as one of the types that this variant can hold.
VariantImp& bdlb::VariantImp< TYPES >::assign | ( | bslmf::MovableRef< TYPE > | value | ) |
Assign to this object the specified value
of template parameter TYPE
, and return a reference providing modifiable access to this object. The contents of value
are moved to this object with value
left in a valid but unspecified state. The value currently held by this variant (if any) is destroyed if that value's type is not the same as TYPE
. TYPE
must be the same as one of the types that this variant can hold.
VariantImp& bdlb::VariantImp< TYPES >::assignTo | ( | const SOURCE_TYPE & | value | ) |
Assign to this object the specified value
of template parameter SOURCE_TYPE
converted to template parameter TYPE
, and return a reference providing modifiable access to this object. The value currently held by this variant (if any) is destroyed if that value's type is not the same as TYPE
. TYPE
must be the same as one of the types that this variant can hold and SOURCE_TYPE
must be convertible to TYPE
.
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1 | ) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8, | |||
const A9 & | a9 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8, | |||
const A9 & | a9, | |||
const A10 & | a10 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8, | |||
const A9 & | a9, | |||
const A10 & | a10, | |||
const A11 & | a11 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8, | |||
const A9 & | a9, | |||
const A10 & | a10, | |||
const A11 & | a11, | |||
const A12 & | a12 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8, | |||
const A9 & | a9, | |||
const A10 & | a10, | |||
const A11 & | a11, | |||
const A12 & | a12, | |||
const A13 & | a13 | |||
) |
TYPE& bdlb::VariantImp< TYPES >::createInPlace | ( | const A1 & | a1, | |
const A2 & | a2, | |||
const A3 & | a3, | |||
const A4 & | a4, | |||
const A5 & | a5, | |||
const A6 & | a6, | |||
const A7 & | a7, | |||
const A8 & | a8, | |||
const A9 & | a9, | |||
const A10 & | a10, | |||
const A11 & | a11, | |||
const A12 & | a12, | |||
const A13 & | a13, | |||
const A14 & | a14 | |||
) |
Create an instance of template parameter TYPE
in this variant object with up to 14 parameters using the allocator currently held by this variant to supply memory, and return a reference providing modifiable access to the created instance. This method first destroys the current value held by this variant (even if TYPE
is the same as the type currently held). TYPE
must be the same as one of the types that this variant can hold. Note the order of the template arguments was chosen so that TYPE
must always be specified.
void bdlb::VariantImp< TYPES >::reset | ( | ) |
Destroy the current value held by this variant (if any), and reset this variant to the unset state.
void bdlb::VariantImp< TYPES >::swap | ( | VariantImp< TYPES > & | other | ) |
Swap the value of this object with the value of the specified other
object. This method provides the no-throw guarantee if the TYPE
template parameter has a no-throw swap
and the two variant objects being swapped have the same type; otherwise this method provides the basic guarantee.
Return a reference providing modifiable access to the value of template parameter TYPE
held by this variant object. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless is<TYPE>()
returns true
and TYPE
is not void
. Note that TYPE
must be specified explicitly, e.g., myValue.the<int>()
.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value returned by the 'visitor. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | const [inline] |
< Apply the specified visitor
to this variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | const [inline] |
< Apply the specified visitor
to this variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | const [inline] |
< Apply the specified visitor
to this variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | const [inline] |
< Apply the specified visitor
to this variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
. This method does not return a value. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RETURN
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor | ) | const |
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor | ) | const |
Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. If this variant is unset, a default constructed bslmf::Nil
is passed to the visitor
.
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | const |
RET_TYPE bdlb::VariantImp< TYPES >::apply | ( | const VISITOR & | visitor, | |
const TYPE & | defaultValue | |||
) | const |
Apply the specified visitor
to this variant by passing the value (of template parameter TYPE
) this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. If this variant is unset, the specified defaultValue
of template parameter TYPE
is passed to the visitor
. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless this variant is unset or holds a value of template parameter TYPE
.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::applyRaw | ( | VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 1, typename VISITOR::ResultType>::type bdlb::VariantImp< TYPES >::applyRaw | ( | const VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value returned by the visitor
. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
defines a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::applyRaw | ( | VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
. This method does not return a value. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
bsl::enable_if<Variant_ReturnValueHelper<VISITOR>::value == 0, void>::type bdlb::VariantImp< TYPES >::applyRaw | ( | const VISITOR & | visitor | ) | const [inline] |
< Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
. This method does not return a value. The behavior is undefined if this variant is unset. Note that this method is selected only if the template parameter type VISITOR
does not define a typedef
of ResultType
in its public interface. Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions.
RET_TYPE bdlb::VariantImp< TYPES >::applyRaw | ( | VISITOR & | visitor | ) | const |
RET_TYPE bdlb::VariantImp< TYPES >::applyRaw | ( | const VISITOR & | visitor | ) | const |
Apply the specified visitor
to this variant by passing the value this variant currently holds to the visitor
object's operator()
, and return the value (of template parameter RET_TYPE
) returned by the visitor
. The behavior is undefined if this variant is unset.
Return true
if the value held by this variant object is of template parameter TYPE
, and false
otherwise. TYPE
must be the same as one of the types that this variant can hold. Note that TYPE
must be specified explicitly, e.g., myValue.is<int>()
.
bool bdlb::VariantImp< TYPES >::isUnset | ( | ) | const |
Return true
if this variant is currently unset, and false
otherwise. An unset variant does not hold a value or type. Note that this method should be preferred over checking the type index of the variant.
bsl::ostream& bdlb::VariantImp< TYPES >::print | ( | bsl::ostream & | stream, | |
int | level = 0 , |
|||
int | spacesPerLevel = 4 | |||
) | const |
Format this object to the specified output stream
at the (absolute value of) the optionally specified indentation level
, and return a reference to stream
. If level
is specified, optionally specify spacesPerLevel
, the number of spaces per indentation level for this and all of its nested objects. If level
is negative, suppress indentation of the first line. If spacesPerLevel
is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level
). If stream
is not valid on entry, this operation has no effect. Nothing is printed if this variant is unset. Each type that may be contained by this variant shall be printable with bdlb::PrintMethods
(typically meaning that they either declare the bdlb::HasPrintMethod
trait or provide the <<
output streaming operator). See bdlb_printmethods
. The compiler will emit an error if bdlb::PrintMethods::print
cannot be instantiated for each type that may be contained by this variant.
Return a reference providing non-modifiable access to the value of template parameter TYPE
held by this variant object. TYPE
must be the same as one of the types that this variant can hold. The behavior is undefined unless is<TYPE>()
returns true
and TYPE
is not void
. Note that TYPE
must be specified explicitly, e.g., myValue.the<int>()
.
int bdlb::VariantImp< TYPES >::typeIndex | ( | ) | const |
Return the index in the list of TYPES
corresponding to the type of the value currently held by this variant object (starting at 1), or 0 if this object is unset. Note that instead of switching code on the type index, calling apply
is the preferred method of manipulating different types stored inside a variant.
const bsl::type_info& bdlb::VariantImp< TYPES >::typeInfo | ( | ) | const |
Return typeid(void)
.
DEPRECATED: Do not use.
STREAM& bdlb::VariantImp< TYPES >::bdexStreamIn | ( | STREAM & | stream, | |
int | version | |||
) |
DEPRECATED: Do not use.
int bdlb::VariantImp< TYPES >::maxSupportedBdexVersion | ( | ) | const |
DEPRECATED: Do not use.
STREAM& bdlb::VariantImp< TYPES >::bdexStreamOut | ( | STREAM & | stream, | |
int | version | |||
) | const |
DEPRECATED: Do not use.