maxSizeOf

Get maximum size of types Ts.

Limitation compared to std.variant.maxSize: Ts cannot contain void.

static
template maxSizeOf (
Ts...
) {
static
enum maxSizeOf;
}

Examples

static assert(maxSizeOf!(char) == 1);
static assert(maxSizeOf!(byte) == 1);
static assert(maxSizeOf!(byte, short) == 2);
static assert(maxSizeOf!(short, byte) == 2);
static assert(maxSizeOf!(byte, short, int) == 4);
static assert(maxSizeOf!(byte, short, int, long) == 8);
static assert(maxSizeOf!(byte, short, int, string) == 16);
static assert(!__traits(compiles, { enum _ = maxSizeOf!(byte, void); }));

Meta