Function objects are objects whose class defines member function operator(). This member function allows the object to be used with the same syntax as a regular function call, and therefore it can be used in templates instead of a pointer to a function.
The function object returned by not2 has its operator() defined such that it returns true when pred would return false, and false when pred would return true.
It is defined with the same behavior as:
| 1 2 3 4 5 |
|
not2 is specifically designed to negate function objects (predicates) derived from binary_function (members first_argument_type and second_argument_type are required). For unary function objects, see not1.
Parameters
- Predicate
- Binary function object derived from binary_function.
Return value
A binary function object with the opposite behavior of pred.binary_negate is a type derived from binary_function.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
First mismatch in bar is 0 First match in bar is 30 |
See also
| not1 | Return negation of unary function object (function template) |
| binary_negate | Generate negation of binary function object class (class template) |
| binary_function | Binary function object base class (class template) |
