multidimStaticArrayElementCount

Calculates the total element count of a multidimensional static array. Considers T to be an n-dimensional static array type.

If T isn't a static array assumes it to be a zero-dimensional static array with single element and returns 1.

template multidimStaticArrayElementCount (
T
size_t n = staticArrayDims!T
) {}

Members

Manifest constants

multidimStaticArrayElementCount
enum multidimStaticArrayElementCount;
Undocumented in source.

Examples

t
{
	static assert(multidimStaticArrayElementCount!int == 1);
	static assert(multidimStaticArrayElementCount!(int[]) == 1);
	static assert(multidimStaticArrayElementCount!(int[0]) == 0);
	static assert(!__traits(compiles, multidimStaticArrayElementCount!(int[7][8], 3)));
	static assert(multidimStaticArrayElementCount!(int[7][8]) == 7 * 8);
	static assert(multidimStaticArrayElementCount!(int[7][8], 1) == 8);
	static assert(multidimStaticArrayElementCount!(int[7][8], 0) == 1);
	static assert(multidimStaticArrayElementCount!(int[0][]) == 1);
	static assert(multidimStaticArrayElementCount!(int[][0]) == 0

Meta