Discriminated union that holds a value of one of up to 20 alternative types.
Synopsis
Declared in <bdlb_variant.h>
template<class... TYPES>
class Variant
: public VariantImp<bslmf::TypeList<TYPES...>::ListType>
Description
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.
Base Classes
Name |
Description |
|
This class provides the implementation of |
Member Functions
Name |
Description |
|
Constructors |
Assignment operators |
|
|
|
|
|
Assign the specified |
|
Assign |
|
DEPRECATED: Do not use. |
|
DEPRECATED: Do not use. |
|
Emplace a |
|
Return whether this variant currently holds a |
|
Return whether this variant currently holds no value. |
|
DEPRECATED: Do not use. |
|
Format this object to the specified output |
|
Destroy the current value held by this variant (if any), and reset this variant to the unset state. |
|
Swap the value of this object with |
|
|
|
Return the 1‐based index of the held type, or 0 if unset. |
|
Return |
|
|
Nested trait declaration for |
Nested trait declaration for |
|
Nested trait declaration for |
|
Nested trait declaration for |
|
|
Nested trait declaration for |
Nested trait declaration for |
|
Nested trait declaration for |
|
Nested trait declaration for |
Non-Member Functions
Name |
Description |
Return whether |
|
Grant the equality comparison operator access to this class's private members. |
|
Return whether |
|
Swap the values of the specified |
Created with MrDocs