Daily bit(e) of C++ | alignment: alignof, alignas, std::align, std::max_align_t
Daily bit(e) of C++ #469, Working with alignment requirements.
Each object in memory has an alignment imposed on it by the alignment requirement of the corresponding type. The alignment requirement is always a power of two and objects with that alignment can only be placed at memory addresses that are multiples of the alignment.
The main consequence of alignment is that consecutive variables or class members might require additional space for necessary padding.
When constructing objects in place, the pointer may need to be manually aligned.