binder1st is generally used as a type. The function bind1st (also defined in header <functional>) can be used to directly construct an object of this type.
binder1st is constructed using a binary function object as argument. A copy of this object is used by its member operator() to generate a result from its parameter and the fixed value set on construction.
This class is derived from unary_function and is typically defined as:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
binder1st class is specifically designed to bind function objects (operations) derived from binary_function (it requires member first_argument_type and second_argument_type).
Members
- constructor
- Constructs an unary function object class from a binary function object by binding its first argument to a value.
- operator()
- Member function taking a single parameter and returning the result of calling the binary function object used at construction with its first argument binded to a specific value.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Output:
There are 2 elements equal to 10. |
See also
| bind1st | Return function object with first parameter binded (function template) |
| binder2nd | Generate function object class with 2nd parameter binded (class template) |
| unary_function | Unary function object base class (class template) |
| binary_function | Binary function object base class (class template) |
