join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::details::VariantStorage< Ts > Struct Template Reference

helper class representing a variant storage in order to be able to disable default/copy/move constructors/operators. More...

#include <variant.hpp>

Public Member Functions

constexpr VariantStorage () noexcept
 default constructor.
 
constexpr VariantStorage (const VariantStorage &other)
 copy constructor.
 
constexpr VariantStorage (VariantStorage &&other) noexcept
 move constructor.
 
template<std::size_t I, typename... Args>
constexpr VariantStorage (in_place_index_t< I >, Args &&... args)
 constructs a variant storage with the alternative T specified by the index I.
 
 ~VariantStorage ()
 destroy the VariantStorage instance.
 
constexpr VariantStorageoperator= (const VariantStorage &other)
 copy assignment.
 
constexpr VariantStorageoperator= (VariantStorage &&other) noexcept
 move assignment.
 
constexpr void * storage ()
 get storage address.
 
constexpr const void * storage () const
 get storage address.
 

Public Attributes

std::aligned_union< std::max({sizeof(Ts)...}), Ts... >::type _data
 aligned storage.
 
std::size_t _which = sizeof... (Ts) - 1
 index of the alternative that is currently held by the variant.
 

Detailed Description

template<typename... Ts>
struct join::details::VariantStorage< Ts >

helper class representing a variant storage in order to be able to disable default/copy/move constructors/operators.

Constructor & Destructor Documentation

◆ VariantStorage() [1/4]

template<typename... Ts>
join::details::VariantStorage< Ts >::VariantStorage ( )
inlineconstexprnoexcept

default constructor.

◆ VariantStorage() [2/4]

template<typename... Ts>
join::details::VariantStorage< Ts >::VariantStorage ( const VariantStorage< Ts > & other)
inlineconstexpr

copy constructor.

Parameters
otherobject to copy.

◆ VariantStorage() [3/4]

template<typename... Ts>
join::details::VariantStorage< Ts >::VariantStorage ( VariantStorage< Ts > && other)
inlineconstexprnoexcept

move constructor.

Parameters
otherobject to move.

◆ VariantStorage() [4/4]

template<typename... Ts>
template<std::size_t I, typename... Args>
join::details::VariantStorage< Ts >::VariantStorage ( in_place_index_t< I > ,
Args &&... args )
inlineexplicitconstexpr

constructs a variant storage with the alternative T specified by the index I.

Parameters
argsarguments to initialize the contained value with.

◆ ~VariantStorage()

template<typename... Ts>
join::details::VariantStorage< Ts >::~VariantStorage ( )
inline

destroy the VariantStorage instance.

Member Function Documentation

◆ operator=() [1/2]

template<typename... Ts>
VariantStorage & join::details::VariantStorage< Ts >::operator= ( const VariantStorage< Ts > & other)
inlineconstexpr

copy assignment.

Parameters
otherobject to copy.
Returns
a reference of the current object.

◆ operator=() [2/2]

template<typename... Ts>
VariantStorage & join::details::VariantStorage< Ts >::operator= ( VariantStorage< Ts > && other)
inlineconstexprnoexcept

move assignment.

Parameters
otherobject to move.
Returns
a reference of the current object.

◆ storage() [1/2]

template<typename... Ts>
void * join::details::VariantStorage< Ts >::storage ( )
inlineconstexpr

get storage address.

Returns
storage address.

◆ storage() [2/2]

template<typename... Ts>
const void * join::details::VariantStorage< Ts >::storage ( ) const
inlineconstexpr

get storage address.

Returns
storage address.

Member Data Documentation

◆ _data

template<typename... Ts>
std::aligned_union<std::max({sizeof(Ts)...}),Ts...>::type join::details::VariantStorage< Ts >::_data

aligned storage.

◆ _which

template<typename... Ts>
std::size_t join::details::VariantStorage< Ts >::_which = sizeof... (Ts) - 1

index of the alternative that is currently held by the variant.


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