31#ifndef ETL_PACKET_INCLUDED
32#define ETL_PACKET_INCLUDED
35#include "static_assert.h"
53 template <
typename TBase,
size_t SIZE,
size_t ALIGNMENT>
67 typedef typename etl::types<T>::type
type;
70 ETL_STATIC_ASSERT(
sizeof(
type) <= SIZE,
"Unsupported size");
73 ::new (
static_cast<type*
>(data))
type(etl::forward<T>(value));
83 ETL_STATIC_ASSERT(
sizeof(T) <= SIZE,
"Unsupported size");
86 ::new (
static_cast<T*
>(data)) T(value);
95 static_cast<TBase*
>(data)->~TBase();
103 template <
typename T>
106 typedef typename etl::types<T>::type
type;
109 ETL_STATIC_ASSERT(
sizeof(
type) <= SIZE,
"Unsupported size");
112 static_cast<TBase*
>(data)->~TBase();
113 ::new (
static_cast<type*
>(data))
type(etl::forward<T>(value));
122 template <
typename T>
126 ETL_STATIC_ASSERT(
sizeof(T) <= SIZE,
"Unsupported size");
129 static_cast<TBase*
>(data)->~TBase();
130 ::new (
static_cast<T*
>(data)) T(value);
141 return *
static_cast<TBase*
>(data);
149 return *
static_cast<const TBase*
>(data);
TBase & get()
Get access to the contained object.
Definition packet.h:139
~packet()
Destructor.
Definition packet.h:93
packet & operator=(const T &value)
Definition packet.h:123
packet(const T &value)
Constructor that static asserts any types that do not conform to the max size and alignment.
Definition packet.h:80
const TBase & get() const
Get access to the contained object.
Definition packet.h:147
add_rvalue_reference
Definition type_traits_generator.h:1413
is_base_of
Definition type_traits_generator.h:1315
bitset_ext
Definition absolute.h:39
Definition alignment.h:248