pointer_to_binary_function is generally used as a type. The function ptr_fun (also defined in header <functional>) can be used to directly construct an object of this type.
This class is derived from binary_function and is typically defined as:
| 1 2 3 4 5 6 7 8 9 10 |
|
Members
- constructor
- Constructs a binary function object class from pointer to a function that takes two arguments of types Arg1 and Arg2, and returns a value of type Result.
- operator()
- Member function taking two parameters, passing them to the function pointed by the pointer used at construction, and forwarding the return value obtained as its own return value.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Possible output:
1 4 9 16 25 |
See also
| ptr_fun | Convert function pointer to function object (function template) |
| pointer_to_unary_function | Generate unary function object class from pointer (class template) |
| unary_function | Unary function object base class (class template) |
