Embedded Template Library 1.0
Loading...
Searching...
No Matches
variant_legacy.h File Reference
#include "../platform.h"
#include "../utility.h"
#include "../array.h"
#include "../largest.h"
#include "../exception.h"
#include "../type_traits.h"
#include "../integral_limits.h"
#include "../static_assert.h"
#include "../alignment.h"
#include "../error_handler.h"
#include "../null_type.h"
#include "../placement_new.h"
#include "../monostate.h"
#include <stdint.h>
#include "diagnostic_uninitialized_push.h"
#include "diagnostic_pop.h"

Go to the source code of this file.

Classes

struct  etl::private_variant::no_type< Id >
class  etl::variant_exception
class  etl::variant_incorrect_type_exception
class  etl::bad_variant_access
class  etl::variant_not_a_base_exception
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, R3, R4, R5, R6, R7, R8 >
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, R3, R4, R5, R6, R7, no_type8 >
 Define the reader type for 7 types. More...
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, R3, R4, R5, R6, no_type7, no_type8 >
 Define the reader type for 6 types. More...
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, R3, R4, R5, no_type6, no_type7, no_type8 >
 Define the reader type for 5 types. More...
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, R3, R4, no_type5, no_type6, no_type7, no_type8 >
 Define the reader type for 4 types. More...
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, R3, no_type4, no_type5, no_type6, no_type7, no_type8 >
 Define the reader type for 3 types. More...
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, R2, no_type3, no_type4, no_type5, no_type6, no_type7, no_type8 >
 Define the reader type for 2 types. More...
class  etl::variant< T1, T2, T3, T4, T5, T6, T7, T8 >::reader_type< R1, no_type2, no_type3, no_type4, no_type5, no_type6, no_type7, no_type8 >
 Define the reader type for 1 type. More...
struct  etl::variant_alternative< tIndex, TVariant >
struct  etl::variant_alternative< tIndex, TVariant const >
struct  etl::variant_alternative< tIndex, TVariant volatile >
struct  etl::variant_alternative< tIndex, TVariant const volatile >

Namespaces

namespace  etl
 bitset_ext

Macros

#define ETL_VARIANT_HELPER(INDEX, TYPE)
#define ETL_GEN_LEGACY_VISIT(VISITQUAL, VARIANTQUAL)

Typedefs

typedef etl::monostate etl::monostate

Functions

template<typename T, typename TVariant>
T & etl::get (TVariant &variant)
template<typename T, typename TVariant>
T const & etl::get (TVariant const &variant)
template<size_t tIndex, typename TVariant>
variant_alternative< tIndex, TVariant >::typeetl::get (TVariant &variant)
template<size_t tIndex, typename TVariant>
variant_alternative< tIndex, TVariantconst >::typeetl::get (TVariant const &variant)

Macro Definition Documentation

◆ ETL_GEN_LEGACY_VISIT

#define ETL_GEN_LEGACY_VISIT ( VISITQUAL,
VARIANTQUAL )
Value:
template <typename TReturn, typename TVisitor, typename TVariant> \
static TReturn visit(TVisitor VISITQUAL visitor, TVariant VARIANTQUAL variant) \
{ \
switch (variant.index()) \
{ \
case 0: return static_cast<TReturn>(visitor(get<0>(variant))); \
case 1: return static_cast<TReturn>(visitor(get<1>(variant))); \
case 2: return static_cast<TReturn>(visitor(get<2>(variant))); \
case 3: return static_cast<TReturn>(visitor(get<3>(variant))); \
case 4: return static_cast<TReturn>(visitor(get<4>(variant))); \
case 5: return static_cast<TReturn>(visitor(get<5>(variant))); \
case 6: return static_cast<TReturn>(visitor(get<6>(variant))); \
case 7: return static_cast<TReturn>(visitor(get<7>(variant))); \
default: ETL_ASSERT_FAIL_AND_RETURN_VALUE(ETL_ERROR(bad_variant_access), TReturn()); \
} \
}

◆ ETL_VARIANT_HELPER

#define ETL_VARIANT_HELPER ( INDEX,
TYPE )
Value:
template <typename T1, \
typename T2, \
typename T3, \
typename T4, \
typename T5, \
typename T6, \
typename T7, \
typename T8> \
struct variant_alternative_helper<INDEX, variant<T1, T2, T3, T4, T5, T6, T7, T8> > \
{ \
typedef TYPE type; \
};