Function count

Counts the elements in an input range.

size_t count(R) (
  R range
)
if (isInputRange!R);

If R has length, count returns it, otherwise it iterates over the range and counts the elements.

Parameters

NameDescription
R Input range type.
range Input range.

Returns

range length.

Example

int[3] array;
assert(count(array) == 3);