Kea  1.5.0
isc::d2::variant< S > Struct Template Reference

A char[S] buffer to store and retrieve objects. More...

#include <d2_parser.h>

Public Types

typedef variant< S > self_type
 Type of *this. More...
 

Public Member Functions

 variant ()
 Empty construction. More...
 
template<typename T >
 variant (YY_RVREF(T) t)
 Construct and fill. More...
 
 ~variant ()
 Destruction, allowed only if empty. More...
 
template<typename T >
T & as ()
 Accessor to a built T. More...
 
template<typename T >
const T & as () const
 Const accessor to a built T (for printer). More...
 
template<typename T >
T & build ()
 Instantiate an empty T in here. More...
 
template<typename T >
T & build (const T &t)
 Instantiate a T in here from t. More...
 
template<typename T >
void copy (const self_type &other)
 Copy the content of other to this. More...
 
template<typename T >
void destroy ()
 Destroy the stored T. More...
 
template<typename T >
T & emplace ()
 Instantiate an empty T in here. More...
 
template<typename T >
T & emplace (const T &t)
 Instantiate a T in here from t. More...
 
template<typename T >
void move (self_type &other)
 Move the content of other to this. More...
 
template<typename T >
void swap (self_type &other)
 Swap the content with other, of same type. More...
 

Detailed Description

template<size_t S>
struct isc::d2::variant< S >

A char[S] buffer to store and retrieve objects.

Sort of a variant, but does not keep track of the nature of the stored data, since that knowledge is available via the current state.

Definition at line 296 of file d2_parser.h.

Member Typedef Documentation

◆ self_type

template<size_t S>
typedef variant<S> isc::d2::variant< S >::self_type

Type of *this.

Definition at line 299 of file d2_parser.h.

Constructor & Destructor Documentation

◆ variant() [1/2]

template<size_t S>
isc::d2::variant< S >::variant ( )
inline

Empty construction.

Definition at line 302 of file d2_parser.h.

◆ variant() [2/2]

template<size_t S>
template<typename T >
isc::d2::variant< S >::variant ( YY_RVREF(T)  t)
inline

Construct and fill.

Definition at line 309 of file d2_parser.h.

◆ ~variant()

template<size_t S>
isc::d2::variant< S >::~variant ( )
inline

Destruction, allowed only if empty.

Definition at line 317 of file d2_parser.h.

Member Function Documentation

◆ as() [1/2]

template<size_t S>
template<typename T >
T& isc::d2::variant< S >::as ( )
inline

◆ as() [2/2]

template<size_t S>
template<typename T >
const T& isc::d2::variant< S >::as ( ) const
inline

Const accessor to a built T (for printer).

Definition at line 389 of file d2_parser.h.

◆ build() [1/2]

template<size_t S>
template<typename T >
T& isc::d2::variant< S >::build ( )
inline

Instantiate an empty T in here.

Obsolete, use emplace.

Definition at line 361 of file d2_parser.h.

◆ build() [2/2]

template<size_t S>
template<typename T >
T& isc::d2::variant< S >::build ( const T &  t)
inline

Instantiate a T in here from t.

Obsolete, use emplace.

Definition at line 370 of file d2_parser.h.

◆ copy()

template<size_t S>
template<typename T >
void isc::d2::variant< S >::copy ( const self_type other)
inline

Copy the content of other to this.

Definition at line 444 of file d2_parser.h.

◆ destroy()

template<size_t S>
template<typename T >
void isc::d2::variant< S >::destroy ( )
inline

Destroy the stored T.

Definition at line 452 of file d2_parser.h.

Referenced by isc::d2::variant< sizeof(union_type)>::move().

◆ emplace() [1/2]

template<size_t S>
template<typename T >
T& isc::d2::variant< S >::emplace ( )
inline

Instantiate an empty T in here.

Definition at line 325 of file d2_parser.h.

◆ emplace() [2/2]

template<size_t S>
template<typename T >
T& isc::d2::variant< S >::emplace ( const T &  t)
inline

Instantiate a T in here from t.

Definition at line 348 of file d2_parser.h.

◆ move()

template<size_t S>
template<typename T >
void isc::d2::variant< S >::move ( self_type other)
inline

Move the content of other to this.

Destroys other.

Definition at line 419 of file d2_parser.h.

◆ swap()

template<size_t S>
template<typename T >
void isc::d2::variant< S >::swap ( self_type other)
inline

Swap the content with other, of same type.

Both variants must be built beforehand, because swapping the actual data requires reading it (with as()), and this is not possible on unconstructed variants: it would require some dynamic testing, which should not be the variant's responsibility. Swapping between built and (possibly) non-built is done with variant::move ().

Definition at line 407 of file d2_parser.h.

Member Data Documentation

◆ yyalign_me

template<size_t S>
long double isc::d2::variant< S >::yyalign_me

Strongest alignment constraints.

Definition at line 484 of file d2_parser.h.

◆ yyraw

template<size_t S>
char isc::d2::variant< S >::yyraw[S]

A buffer large enough to store any of the semantic values.

Definition at line 486 of file d2_parser.h.


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