Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Public Member Functions | Public Attributes | List of all members
serac::detail::variant_storage< T0, T1, SFINAE > Struct Template Reference

Storage abstraction to provide trivial destructor when both variant types are trivially destructible. More...

#include <variant.hpp>

Public Member Functions

constexpr variant_storage (const variant_storage &other)
 Copy constructor for nontrivial types Placement-new is required to correctly initialize the union. More...
 
constexpr variant_storage (variant_storage &&other)
 Move constructor for nontrivial types Placement-new is required to correctly initialize the union. More...
 
constexpr void clear ()
 Resets the union by destroying the active member. More...
 
constexpr variant_storage ()
 Default constructor Default initializes the first member of the variant.
 
 ~variant_storage ()
 Destroys the variant by calling the destructor of the active member.
 

Public Attributes

int index_ = 0
 The index of the active member.
 
union {
   T0   t0_
 
   T1   t1_
 
}; 
 

Detailed Description

template<typename T0, typename T1, typename SFINAE = void>
struct serac::detail::variant_storage< T0, T1, SFINAE >

Storage abstraction to provide trivial destructor when both variant types are trivially destructible.

Template Parameters
T0The type of the first variant element
T1The type of the second variant element
SFINAEUsed to switch between the trivially destructible and not-trivially destructible implementations

Definition at line 34 of file variant.hpp.

Constructor & Destructor Documentation

◆ variant_storage() [1/2]

template<typename T0 , typename T1 , typename SFINAE = void>
constexpr serac::detail::variant_storage< T0, T1, SFINAE >::variant_storage ( const variant_storage< T0, T1, SFINAE > &  other)
inlineconstexpr

Copy constructor for nontrivial types Placement-new is required to correctly initialize the union.

Parameters
[in]otherThe variant_storage to copy from

Definition at line 49 of file variant.hpp.

◆ variant_storage() [2/2]

template<typename T0 , typename T1 , typename SFINAE = void>
constexpr serac::detail::variant_storage< T0, T1, SFINAE >::variant_storage ( variant_storage< T0, T1, SFINAE > &&  other)
inlineconstexpr

Move constructor for nontrivial types Placement-new is required to correctly initialize the union.

Parameters
[in]otherThe variant_storage to move from

Definition at line 68 of file variant.hpp.

Member Function Documentation

◆ clear()

template<typename T0 , typename T1 , typename SFINAE = void>
constexpr void serac::detail::variant_storage< T0, T1, SFINAE >::clear ( )
inlineconstexpr

Resets the union by destroying the active member.

Note
The index is technically invalid here after this function is called

Definition at line 86 of file variant.hpp.


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