case of a Binary Function.
int main() {
vector<char*> v1(10, (char*) 0);
vector<int> v2(10, 137);
vector<int> result(10);
transform(v1.begin(), v1.end(), v2.begin(), result.begin(), project2nd<char*, int> ());
assert(equal(v2.begin(), v2.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, Arg2>
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&, const Arg2& y) const | Adaptable Binary Function | Function call. The return value is |
All of
Function objects,
select1st<Pair>
Category: functors
Component type: type
Print all of a
int main() {
map<int, double> M;
M[1] = 0.3;
M[47] = 0.8;
M[33] = 0.1;
transform(M.begin(), M.end(), ostream_iterator<int>(cout, ' '), select1st<map<int, double>::value_type>());
// The output is 1 33 47.
}
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 |
---|