classInstanceAlignment

Returns class instance alignment.

See also: __traits(classInstanceAlignment, T)

template classInstanceAlignment (
T
) if (
is(T == class)
) {
enum classInstanceAlignment;
}

Examples

class A { byte b; }
class B { long l; }

// As class instance always has a hidden pointer
static assert(classInstanceAlignment!A == (void*).alignof);
static assert(classInstanceAlignment!B == long.alignof);

Meta