C++ concepts: Predicate

< cpp‎ | concept
Revision as of 21:10, 3 March 2014 by Cubbi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Predicate concept describes a function object that takes a single iterator argument that is dereferenced and used to return a value testable as a bool.

In other words, if an algorithm takes a Predicate pred and an iterator first, it should be able to test the iterator using the predicate via a construct like if (pred(*first)) {...}.

The function object pred 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.

[edit] Requirements