3 #ifndef DUNE_ALIGNMENT_HH 4 #define DUNE_ALIGNMENT_HH 31 struct AlignmentStruct
42 template<
class T, std::
size_t N>
43 struct AlignmentHelper
45 enum { N2 =
sizeof(AlignmentStruct<T>) -
sizeof(T) - N };
51 #define ALIGNMENT_MODULO(a, b) (a % b == 0 ? \ 52 static_cast<std::size_t>(b) : \ 53 static_cast<std::size_t>(a % b)) 54 #define ALIGNMENT_MIN(a, b) (static_cast<std::size_t>(a) < \ 55 static_cast<std::size_t>(b) ? \ 56 static_cast<std::size_t>(a) : \ 57 static_cast<std::size_t>(b)) 59 template <
class T, std::
size_t N>
60 struct AlignmentTester
62 typedef AlignmentStruct<T> s;
63 typedef AlignmentHelper<T, N> h;
64 typedef AlignmentTester<T, N - 1> next;
77 struct AlignmentTester<T, 0>
101 value = std::alignment_of<T>::value
char padding1[N]
Definition: alignment.hh:46
char padding2[N2]
Definition: alignment.hh:48
Calculates the alignment requirement of a type.
Definition: alignment.hh:95
#define ALIGNMENT_MODULO(a, b)
Definition: alignment.hh:51
char c
Definition: alignment.hh:33
#define ALIGNMENT_MIN(a, b)
Definition: alignment.hh:54
T t
Definition: alignment.hh:34
Dune namespace.
Definition: alignment.hh:9