|
class | AlignedUnion< TArgs > |
| Stores value of type std::aligned_union, having size and alignment equal to maximum of sizes and alignments of template types. More...
|
|
struct | VariantHelpers::DefaultCreate< TArgs > |
| Creates a variant using default constructor. More...
|
|
struct | VariantHelpers::Delete< TArgs > |
| Destroys the object currently stored in variant. More...
|
|
struct | VariantHelpers::CopyMoveCreate< TArgs > |
| Creates a variant by copying/moving value currently stored in other variant. More...
|
|
struct | VariantHelpers::Assign< TArgs > |
| Assigns a value type of which can be stored in variant. More...
|
|
struct | VariantHelpers::CopyMoveAssign< TArgs > |
| Creates a variant by copying/moving value currently stored in other variant. More...
|
|
struct | VariantHelpers::Swap< TArgs > |
| Swaps content of two variants. More...
|
|
struct | VariantIterator< T0, TArgs > |
| Iterates through types of variant until idx-th type is found, and executes given TVisitor, passing arguments to its method visit. More...
|
|
struct | VariantIterator< T0 > |
| Specialization for last type. More...
|
|
struct | ConstructTypeIdxTag |
| Tag for invoking constructor with type index as parameter.
|
|
class | Variant< TArgs > |
| Variant, an implementation of type-safe union, similar to std::variant or boost::variant. More...
|
|
struct | Detail::ForValue< N, T0, TArgs > |
|
struct | Detail::ForValue< N, NothingType, TArgs... > |
|
struct | Detail::ForValue< N, T0 > |
|
Object capable of storing values of different types.
- Author
- Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)
- Date
- 2016-2021
Definition in file Variant.h.
template<typename TFunctor , typename... TArgs>
decltype(auto) INLINE forValue |
( |
Variant< TArgs... > & |
variant, |
|
|
TFunctor && |
functor |
|
) |
| |
Executes a functor passing current value stored in variant as its parameter. The functor must either have templated operator() (i.e. generic lambda), or have an overloaded operator for each type contained in variant. If the variant contains type NothingType, the functor not called for this type. This allows to call generic functions, defined on other types while keeping NothingType as a special value representing an empty variant.
- Parameters
-
variant | Variant, must contain a value (checked by assert). |
functor | Executed functor, takes one parameter - value obtained from Variant. |
- Returns
- Value returned by the functor.
Definition at line 428 of file Variant.h.