cpp/named req/Predicate

The requirements describe a callable that returns a value testable as a.

is typically used with algorithms that take input data (individual objects/containers) and a predicate, which is then called on input data to decide on further course of action. Some examples of predicate usage in C++ standard library are:


 * ,,  Take an array of elements and a predicate as an input. Call predicate on individual input elements, and return true if for all/any/none elements, predicate returns true.


 * Take sequence of elements, and a predicate. Return first element in the sequence, for which predicate returns value equal to

Description of algorithm facilities, given above, is crude and intended to explain in simple terms. For detailed info, refer to individual pages.

In other words, if an algorithm takes a  and an iterator, it should be able to test the object of the type pointed to by the iterator  using the given predicate via a construct like.

The function object shall not apply any non-constant function through the dereferenced iterator. This function object may be a pointer to function or an object of a type with an appropriate function call operator.