std::aligned_storage (3) - Linux Man Pages
Defined in header <type_traits>
template< std::size_t Len, std::size_t Align = /*default-alignment*/ > (since C++11)
Provides the nested type type, which is a trivial standard-layout type suitable for use as uninitialized storage for any object whose size is at most Len and whose alignment_requirement is a divisor of Align.
The default value of Align is the most stringent (the largest) alignment requirement for any object whose size is at most Len. If the default value is not used, Align must be the value of alignof(T) for some type T, or the behavior is undefined.
The behavior is undefined if Len == 0.
It is implementation-defined whether any extended_alignment is supported.
type the POD type of at least size Len with alignment requirement Align
template< std::size_t Len, std::size_t Align = /*default-alignment*/ > (since C++14)
using aligned_storage_t = typename aligned_storage<Len, Align>::type;
The type defined by std::aligned_storage<>::type can be used to create uninitialized memory blocks suitable to hold the objects of given type, optionally aligned stricter than their natural alignment requirement, for example on a cache or page boundary.
As with any other uninitialized storage, the objects are created using placement_new and destroyed with explicit destructor calls.
Except for default argument, aligned_storage is expressible in terms of alignas:
A primitive static vector class, demonstrating creation, access, and destruction of objects in aligned storage
// Run this code