C++11 added the ability to specify increased alignment (over-alignment) for
class types. Unfortunately,
and the Default Allocator,
do not support dynamic memory allocation of over-aligned data. This library
provides allocation functions and allocators that respect the alignment requirements
of a type and so are suitable for allocating memory for over-aligned types.
Replaces use of Allocator
std::align in the standard library to align a
pointer value. Unfortunately some C++ standard library implementations do not
support it yet (libstdc++ as far as gcc 4.8.0) and other standard library implementations
implement it incorrectly (dinkumware in msvc11.0). This library provides it
for those implementations and also for C++03 compilers where it is equally
C++11 provided the
std::alignment_of trait in the standard library
to query the alignment requirement of a type. Unfortunately some C++ standard
library vendors do not implement it in an entirely standard conforming manner,
such as for array types (libc++ as far as clang 3.4). Other vendor implementations
report incorrect values for certain types, such as pointer to members (msvc
14.0). This library provides it for those implementations and also for C++03
compilers where it is equally useful.
Allocating aligned memory is sometimes not enough to ensure that optimal code
is generated. Developers use specific compiler intrinsics to notify the compiler
of a given alignment property of a memory block. This library provides a macro,
to abstract that functionality for compilers with the appropriate intrinsics.
This library provides a function,
to test the alignment of a pointer value. It is generally useful in assertions
to validate that memory is correctly aligned.