cds
2.3.2
|
Aligned type. More...
#include <cds/details/aligned_type.h>
Aligned type.
This meta-algorithm solves compiler problem when you need to declare a type T
with alignment equal to another type alignment. For example, the following declaration produces an error in Microsoft Visual Studio 2008 compiler:
In MS VS, the __declspec(align(N)) construction requires that N must be a integer constant (1, 2, 4 and so on) but not an integer constant expression.
The result of this meta-algo is a type aligned_type<T,Alignment>::type
that is T
aligned by Alignment
. For example, with aligned_type
the prevoius example will not generate an error:
and result of this declaration is equivalent to
The Alignment
template parameter must be a constant expression and its result must be power of two. The maximum of its value is 1024.
See also align_as