The OpenD Programming Language

all

Checks if _all of the elements satisfy pred.

template all(alias pred = "a")
bool
all
(
Range
)
(
Range range
)
if (
isInputRange!Range &&
(
__traits(isTemplate, pred) ||
is(typeof(unaryFun!pred(range.front)))
)
)

Members

Functions

all
bool all(Range range)

Returns true if and only if the input range range is empty or _all values found in range satisfy the predicate pred. Performs (at most) O(range.length) evaluations of pred.

Examples

assert( all!"a & 1"([1, 3, 5, 7, 9]));
assert(!all!"a & 1"([1, 2, 3, 5, 7, 9]));

all can also be used without a predicate, if its items can be evaluated to true or false in a conditional statement. This can be a convenient way to quickly evaluate that _all of the elements of a range are true.

int[3] vals = [5, 3, 18];
assert( all(vals[]));

Meta