requirements.
[1] It is essential that the return type and the argument type are the same: generalizing
The function object overview,
project1st<Arg1, Arg2>
Category: functors
Component type: type
int main() {
vector<int> v1(10, 137);
vector<char*> v2(10, (char*) 0);
vector<int> result(10);
transform(v1.begin(), v1.end(), v2.begin(), result.begin(), project1st<int, char*> ());
assert(equal(v1.begin(), v1.end(), result.begin()));
}
Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h. This function object is an SGI extension; it is not part of the C++ standard.
Parameter | Description |
---|---|
Arg1 | |
Arg2 |
Adaptable Binary Function
None.
binary_function<Arg1, Arg2, Arg1>
Member | Where defined | Description |
---|---|---|
first_argument_type | Adaptable Binary Function | The type of |
second_argument_type | Adaptable Binary Function | The type of |
result_type | Adaptable Binary Function | The type of the result: |
Arg1 operator()(const Arg1& x, const Arg2&) const | Adaptable Binary Function | Function call. The return value is |
All of
Function objects,
project2nd<Arg1, Arg2>
Category: functors
Component type: type