Discriminated union that holds a value of one of up to 20 alternative types.
Declared in <bdlb_variant.h>
template<class... TYPES>
class Variant
: public VariantImp<bslmf::TypeList<TYPES...>::ListType>
This class provides a "variant" type, i.e., a type capable of storing values from a list of template parameter types. Note that if the number N of types is smaller than 20, unused parameters default to bslmf::Nil, but it is more economical to use VariantN, which accepts exactly N template arguments, as this leads to shorter symbols and debug string information.
| Name | Description |
|---|---|
VariantImp<bslmf::TypeList<TYPES...>::ListType> | This class provides the implementation of Variant (except for the creators) given a list of template parameter TYPES. |
| Name | Description |
|---|---|
Variant [constructor] | Constructors |
operator= | Assignment operators |
apply | apply overloads |
applyRaw | applyRaw overloads |
assign | Assign the specified TYPE value to this object. |
assignTo | Assign value converted to TYPE to this object. |
bdexStreamIn | DEPRECATED: Do not use. |
bdexStreamOut | DEPRECATED: Do not use. |
createInPlace | Emplace a TYPE instance constructed from arguments. |
is | Return whether this variant currently holds a TYPE value. |
isUnset | Return whether this variant currently holds no value. |
maxSupportedBdexVersion | DEPRECATED: Do not use. |
print | Format this object to the specified output stream. |
reset | Destroy the current value held by this variant (if any), and reset this variant to the unset state. |
swap | Swap the value of this object with other. |
the | the overloads |
typeIndex | Return the 1-based index of the held type, or 0 if unset. |
typeInfo | Return typeid(void). |
operator BloombergLP::bslmf::NestedTraitDeclaration<Variant, HasPrintMethod> | Nested trait declaration for bdlb::HasPrintMethod. |
operator BloombergLP::bslmf::NestedTraitDeclaration<Variant, IsBitwiseCopyable, Traits::k_VARIANT_IS_BITWISE_COPYABLE> | Nested trait declaration for bslmf::IsBitwiseCopyable. |
operator BloombergLP::bslmf::NestedTraitDeclaration<Variant, IsBitwiseMoveable, Traits::k_VARIANT_IS_BITWISE_MOVEABLE> | Nested trait declaration for bslmf::IsBitwiseMoveable. |
operator BloombergLP::bslmf::NestedTraitDeclaration<Variant, UsesBslmaAllocator, Traits::k_VARIANT_USES_BSLMA_ALLOCATOR> | Nested trait declaration for bslma::UsesBslmaAllocator. |
operator BloombergLP::bslmf::NestedTraitDeclaration<VariantImp, HasPrintMethod> | Nested trait declaration for bdlb::HasPrintMethod. |
operator BloombergLP::bslmf::NestedTraitDeclaration<VariantImp, IsBitwiseCopyable, Traits::k_VARIANT_IS_BITWISE_COPYABLE> | Nested trait declaration for bslmf::IsBitwiseCopyable. |
operator BloombergLP::bslmf::NestedTraitDeclaration<VariantImp, IsBitwiseMoveable, Traits::k_VARIANT_IS_BITWISE_MOVEABLE> | Nested trait declaration for bslmf::IsBitwiseMoveable. |
operator BloombergLP::bslmf::NestedTraitDeclaration<VariantImp, UsesBslmaAllocator, Traits::k_VARIANT_USES_BSLMA_ALLOCATOR> | Nested trait declaration for bslma::UsesBslmaAllocator. |
| Name | Description |
|---|---|
operator!= | Return whether lhs and rhs do not have the same value. |
operator== | Grant the equality comparison operator access to this class's private members. |
operator== | Return whether lhs and rhs have the same value. |
swap | Swap the values of the specified a and b objects. |