...
The C++ standard library implements numerous common algorithms that accept a predicate function object. The C++ Standard, [algorithms.general], paragraph 10 [ISO/IEC 14882-2014], states :
[Note: Unless otherwise specified, algorithms that take function objects as arguments are permitted to copy those function objects freely. Programmers for whom object identity is important should consider using a wrapper class that points to a noncopied implementation object such as
reference_wrapper<T>
, or some equivalent solution. — end note]
...
Bibliography
[ISO/IEC 14882-2014] | Subclause 25.1, "General" |
[Meyers 01] | Item 39, Make predicates pure functions"Make Predicates Pure Functions" |
...