Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::variant< Alts > Struct Template Reference

#include <variant.hpp>

Inheritance diagram for mundy::variant< Alts >:
[legend]

Helpers

template<size_t J>
using alternative_t = type_at_index_t<J, Alts...>
 The J'th alternative type.
constexpr variant ()
 Default constructor initializes the first type as active.
template<class T>
constexpr variant (const T &value)
 Constructor for initializing with a specific type.
constexpr size_t index () const
 Get the active type index.
template<class T>
constexpr bool holds_alternative () const
 Check if a specific type is active.
template<class T>
constexpr T & get ()
 Get the value of the active type.
template<class T>
constexpr const T & get () const
template<size_t ActiveIdx>
constexpr auto get () -> alternative_t< ActiveIdx > &
 Get the value of the active type based on the active index.
template<size_t ActiveIdx>
constexpr auto get () const -> const alternative_t< ActiveIdx > &
template<class T>
constexpr void operator= (T const &value)
 Set a new active type, default-constructing the previous type.
static constexpr size_t size ()
 Get the number of alternatives.
template<class T>
static constexpr size_t index_of ()

Member Typedef Documentation

◆ alternative_t

template<class... Alts>
template<size_t J>
using mundy::variant< Alts >::alternative_t = type_at_index_t<J, Alts...>

Constructor & Destructor Documentation

◆ variant() [1/2]

template<class... Alts>
mundy::variant< Alts >::variant ( )
inlineconstexpr

◆ variant() [2/2]

template<class... Alts>
template<class T>
mundy::variant< Alts >::variant ( const T & value)
inlineconstexpr

Member Function Documentation

◆ index()

template<class... Alts>
size_t mundy::variant< Alts >::index ( ) const
inlineconstexpr

◆ size()

template<class... Alts>
constexpr size_t mundy::variant< Alts >::size ( )
inlinestaticconstexpr

◆ index_of()

template<class... Alts>
template<class T>
constexpr size_t mundy::variant< Alts >::index_of ( )
inlinestaticconstexpr

◆ holds_alternative()

template<class... Alts>
template<class T>
bool mundy::variant< Alts >::holds_alternative ( ) const
inlineconstexpr

◆ get() [1/4]

template<class... Alts>
template<class T>
T & mundy::variant< Alts >::get ( )
inlineconstexpr

◆ get() [2/4]

template<class... Alts>
template<class T>
const T & mundy::variant< Alts >::get ( ) const
inlineconstexpr

◆ get() [3/4]

template<class... Alts>
template<size_t ActiveIdx>
auto mundy::variant< Alts >::get ( ) -> alternative_t< ActiveIdx > &
inlineconstexpr

◆ get() [4/4]

template<class... Alts>
template<size_t ActiveIdx>
auto mundy::variant< Alts >::get ( ) const -> const alternative_t< ActiveIdx > &
inlineconstexpr

◆ operator=()

template<class... Alts>
template<class T>
void mundy::variant< Alts >::operator= ( T const & value)
inlineconstexpr