Utilities - T_VarStorage< Type >

A type that allocates storage for a value of a given type.
This commit is contained in:
Emmanuel BENOîT 2020-09-27 13:47:58 +02:00
parent b8db177012
commit a22cca26e2

View file

@ -229,6 +229,15 @@ template< typename T >
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
// T_VarStorage< DataType > - A storage buffer with the correct size and
// alignment for the specified data type.
template< typename DataType >
using T_VarStorage = typename std::aligned_storage<
sizeof( DataType ) , alignof( DataType )
>::type;
/*----------------------------------------------------------------------------*/
// Define a structure that can be used as a tag // Define a structure that can be used as a tag
#define M_DEFINE_TAG( NAME ) \ #define M_DEFINE_TAG( NAME ) \
struct NAME { } struct NAME { }