AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
Aws::Crt::Variant< Ts > Class Template Reference

#include <Variant.h>

Public Types

using IndexT = VariantDetail::Index::VariantIndex
 
template<std::size_t Index>
using RawAlternativePointerT = typename std::add_pointer< typename ThisVariantAlternative< Index >::type >::type
 
template<std::size_t Index>
using ConstRawAlternativePointerT = typename std::add_pointer< typename std::add_const< typename ThisVariantAlternative< Index >::type >::type >::type
 

Public Member Functions

 Variant ()
 
 Variant (const Variant &other)
 
 Variant (Variant &&other)
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
 Variant (const T &val)
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
 Variant (T &&val)
 
template<typename T , typename... Args>
 Variant (Aws::Crt::InPlaceTypeT< T >, Args &&...args)
 
Variantoperator= (const Variant &other)
 
Variantoperator= (Variant &&other)
 
template<typename T , typename... Args, EnableIfOtherIsThisVariantAlternative< T > = 1>
T & emplace (Args &&...args)
 
template<std::size_t Index, typename... Args>
auto emplace (Args &&...args) -> typename ThisVariantAlternative< Index >::type &
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
bool holds_alternative () const
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
T & get ()
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
T * get_if ()
 
template<std::size_t Index>
auto get () -> typename ThisVariantAlternative< Index >::type &
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
const T & get () const
 
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
const T * get_if () const
 
template<std::size_t Index>
auto get () const -> const typename ThisVariantAlternative< Index >::type &
 
template<std::size_t Index>
auto get_if () -> RawAlternativePointerT< Index >
 
template<std::size_t Index>
auto get_if () const -> ConstRawAlternativePointerT< Index >
 
std::size_t index () const
 
 ~Variant ()
 
template<typename VisitorT >
void Visit (VisitorT &&visitor)
 

Static Public Attributes

static constexpr std::size_t AlternativeCount = sizeof...(Ts)
 

Detailed Description

template<typename... Ts>
class Aws::Crt::Variant< Ts >

Custom implementation of a Variant type. std::variant requires C++17

Template Parameters
Tstypes of the variant value

Member Typedef Documentation

◆ ConstRawAlternativePointerT

template<typename... Ts>
template<std::size_t Index>
using Aws::Crt::Variant< Ts >::ConstRawAlternativePointerT = typename std::add_pointer< typename std::add_const<typename ThisVariantAlternative<Index>::type>::type>::type

◆ IndexT

template<typename... Ts>
using Aws::Crt::Variant< Ts >::IndexT = VariantDetail::Index::VariantIndex

◆ RawAlternativePointerT

template<typename... Ts>
template<std::size_t Index>
using Aws::Crt::Variant< Ts >::RawAlternativePointerT = typename std::add_pointer<typename ThisVariantAlternative<Index>::type>::type

Constructor & Destructor Documentation

◆ Variant() [1/6]

template<typename... Ts>
Aws::Crt::Variant< Ts >::Variant ( )
inline

◆ Variant() [2/6]

template<typename... Ts>
Aws::Crt::Variant< Ts >::Variant ( const Variant< Ts > &  other)
inline

◆ Variant() [3/6]

template<typename... Ts>
Aws::Crt::Variant< Ts >::Variant ( Variant< Ts > &&  other)
inline

◆ Variant() [4/6]

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
Aws::Crt::Variant< Ts >::Variant ( const T &  val)
inline

◆ Variant() [5/6]

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
Aws::Crt::Variant< Ts >::Variant ( T &&  val)
inline

◆ Variant() [6/6]

template<typename... Ts>
template<typename T , typename... Args>
Aws::Crt::Variant< Ts >::Variant ( Aws::Crt::InPlaceTypeT< T >  ,
Args &&...  args 
)
inlineexplicit

◆ ~Variant()

template<typename... Ts>
Aws::Crt::Variant< Ts >::~Variant ( )
inline

Member Function Documentation

◆ emplace() [1/2]

template<typename... Ts>
template<typename T , typename... Args, EnableIfOtherIsThisVariantAlternative< T > = 1>
T& Aws::Crt::Variant< Ts >::emplace ( Args &&...  args)
inline

◆ emplace() [2/2]

template<typename... Ts>
template<std::size_t Index, typename... Args>
auto Aws::Crt::Variant< Ts >::emplace ( Args &&...  args) -> typename ThisVariantAlternative<Index>::type &
inline

◆ get() [1/4]

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
T& Aws::Crt::Variant< Ts >::get ( )
inline

◆ get() [2/4]

template<typename... Ts>
template<std::size_t Index>
auto Aws::Crt::Variant< Ts >::get ( ) -> typename ThisVariantAlternative<Index>::type &
inline

◆ get() [3/4]

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
const T& Aws::Crt::Variant< Ts >::get ( ) const
inline

◆ get() [4/4]

template<typename... Ts>
template<std::size_t Index>
auto Aws::Crt::Variant< Ts >::get ( ) const -> const typename ThisVariantAlternative<Index>::type &
inline

◆ get_if() [1/4]

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
T* Aws::Crt::Variant< Ts >::get_if ( )
inline

◆ get_if() [2/4]

template<typename... Ts>
template<std::size_t Index>
auto Aws::Crt::Variant< Ts >::get_if ( ) -> RawAlternativePointerT<Index>
inline

◆ get_if() [3/4]

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
const T* Aws::Crt::Variant< Ts >::get_if ( ) const
inline

◆ get_if() [4/4]

template<typename... Ts>
template<std::size_t Index>
auto Aws::Crt::Variant< Ts >::get_if ( ) const -> ConstRawAlternativePointerT<Index>
inline

◆ holds_alternative()

template<typename... Ts>
template<typename T , EnableIfOtherIsThisVariantAlternative< T > = 1>
bool Aws::Crt::Variant< Ts >::holds_alternative ( ) const
inline

◆ index()

template<typename... Ts>
std::size_t Aws::Crt::Variant< Ts >::index ( ) const
inline

◆ operator=() [1/2]

template<typename... Ts>
Variant& Aws::Crt::Variant< Ts >::operator= ( const Variant< Ts > &  other)
inline

◆ operator=() [2/2]

template<typename... Ts>
Variant& Aws::Crt::Variant< Ts >::operator= ( Variant< Ts > &&  other)
inline

◆ Visit()

template<typename... Ts>
template<typename VisitorT >
void Aws::Crt::Variant< Ts >::Visit ( VisitorT &&  visitor)
inline

Member Data Documentation

◆ AlternativeCount

template<typename... Ts>
constexpr std::size_t Aws::Crt::Variant< Ts >::AlternativeCount = sizeof...(Ts)
staticconstexpr

The documentation for this class was generated from the following file: