4#include "../Foundation/PrimitiveTypes.h"
9template <
typename T,
size_t E,
size_t R = sizeof(T)>
10void static_assert_size()
12 static_assert(R <= E,
"Size mismatch");
23template <
int N,
int Alignment = alignof(
void*)>
37 static_assert_size<T, N>();
38 static_assert(
alignof(T) <= Alignment,
"Increase Alignment of AlignedStorage");
39 return *
reinterpret_cast<T*
>(bytes);
53 static_assert_size<T, N>();
54 static_assert(
alignof(T) <= Alignment,
"Increase Alignment of AlignedStorage");
55 return *
reinterpret_cast<const T*
>(bytes);
59 alignas(Alignment)
char bytes[N] = {0};
A buffer of bytes with given alignment.
Definition: AlignedStorage.h:25
T & reinterpret_as()
Access wanted OS Handle with it's actual type.
Definition: AlignedStorage.h:35
const T & reinterpret_as() const
Access wanted OS Handle with it's actual type.
Definition: AlignedStorage.h:51