all

Checks if _all of the elements verify pred.

template all(alias pred = "a")
bool
all
(
Range
)
(
Range range
)
if ()

Members

Functions

all
bool all(Range range)

Returns true if and only if _all values v found in the input range 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

Suggestion Box / Bug Report