Namespaces
Variants
Views
Actions

C++ concepts: Predicate

From cppreference.com
< cpp‎ | concept
Revision as of 13:37, 22 January 2013 by Nate (Talk | contribs)

 
 
 

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.

Requirements