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. }Definition 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. Template parameters Parameter Description Default Pair The function object's argument type. Model ofAdaptable Unary FunctionAdaptable Unary FunctionAdaptable Unary Function Type requirements There exist some types U and V such that Pair provides the same interface as a pair<U,V>. [1] Public base classesunary_function<Pair, Pair::first_type> Members New members All of select1st's members are defined in the Adaptable Unary Function requirements. Select1st does not introduce any new members. Notes
[1] Pair is not actually required to be a pair<U,V>, but merely to support the same interface as pair. In almost all cases the template parameter will be a pair, but it is occasionally useful for it to be something else. One example is a struct that has the members first, second, and third.
See alsoidentity, select2nd, project1st, project2nd STL Main PageRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4