View source code Display the source code in std/algorithm/searching.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Template std.algorithm.searching.all

Checks if all of the elements verify pred.

Arguments

template all(alias pred);

Functions

Function name Description
all

Example

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

Example

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[]));

Authors

Andrei Alexandrescu

License

Boost License 1.0.

Comments