ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::lang::Placeholder< T > Struct Template Reference

Description:

template<typename T>
struct alib::lang::Placeholder< T >

Templated helper that reserves memory of size and alignment corresponding to type T. Along with that, construction, destruction and reinterpretation casts are given in various ways.

The type is used for class members or (less frequently for local variables), whose construction has to be deferred.

Template Parameters
TThe type to replace.

Definition at line 20 of file lang/placeholder.hpp.

#include <placeholder.hpp>

Public Field Index:

char bytes [sizeof(T)]
 the placeholder space.

Public Method Index:

 Placeholder ()
 Constructor. Initializes the occupied memory with 0-bytes.
template<typename... TArgs>
void Construct (TArgs &&... args)
void Destruct ()
 Destructs the custom type T represented by this placeholder.
T * Get ()
const T * Get () const
T & operator* ()
const T & operator* () const
T * operator-> ()
const T * operator-> () const

Field Details:

◆ bytes

template<typename T>
char alib::lang::Placeholder< T >::bytes[sizeof(T)]

the placeholder space.

Definition at line 22 of file lang/placeholder.hpp.

Constructor(s) / Destructor Details:

◆ Placeholder()

template<typename T>
alib::lang::Placeholder< T >::Placeholder ( )
inline

Constructor. Initializes the occupied memory with 0-bytes.

Definition at line 25 of file lang/placeholder.hpp.

Method Details:

◆ Construct()

template<typename T>
template<typename... TArgs>
void alib::lang::Placeholder< T >::Construct ( TArgs &&... args)
inline

Constructs the custom type T represented by this placeholder.

Template Parameters
TArgsThe argument types used for constructing T.
Parameters
argsThe arguments to construct the instance of T.

Definition at line 31 of file lang/placeholder.hpp.

◆ Destruct()

template<typename T>
void alib::lang::Placeholder< T >::Destruct ( )
inline

Destructs the custom type T represented by this placeholder.

Definition at line 34 of file lang/placeholder.hpp.

Here is the call graph for this function:

◆ Get() [1/2]

template<typename T>
T * alib::lang::Placeholder< T >::Get ( )
inline

Returns a non-constant pointer to the represented instance of type T.

Returns
A pointer to T.

Definition at line 38 of file lang/placeholder.hpp.

◆ Get() [2/2]

template<typename T>
const T * alib::lang::Placeholder< T >::Get ( ) const
inline

Returns a constant pointer to the represented instance of type T.

Returns
A pointer to T.

Definition at line 42 of file lang/placeholder.hpp.

◆ operator*() [1/2]

template<typename T>
T & alib::lang::Placeholder< T >::operator* ( )
inline

Overloaded operator to access the represented instance of type T.

Returns
A pointer to T.

Definition at line 54 of file lang/placeholder.hpp.

Here is the call graph for this function:

◆ operator*() [2/2]

template<typename T>
const T & alib::lang::Placeholder< T >::operator* ( ) const
inline

Overloaded operator to access the represented instance of type T.

Returns
A constant pointer to T.

Definition at line 58 of file lang/placeholder.hpp.

Here is the call graph for this function:

◆ operator->() [1/2]

template<typename T>
T * alib::lang::Placeholder< T >::operator-> ( )
inline

Overloaded operator to access the represented instance of type T.

Returns
A pointer to T.

Definition at line 46 of file lang/placeholder.hpp.

Here is the call graph for this function:

◆ operator->() [2/2]

template<typename T>
const T * alib::lang::Placeholder< T >::operator-> ( ) const
inline

Overloaded operator to access the represented instance of type T.

Returns
A constant pointer to T.

Definition at line 50 of file lang/placeholder.hpp.

Here is the call graph for this function:

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