Is there a builtin function object that returns p->first
and p->second
, so that I can happily write
transform(m.begin(),m.end
If you can use C++0x you can either use real lambdas since G++ 4.5 or you can use the new tuple-library which is fully compatible with std::pairs. Then you could use std::get<0> for first and std::get<1> for second.
If you are bound to C++98 you can use std::tr1::tuple instead of std::pair, as in TR1 get doesn't work with std::pair.
Also you can use bind from TR1 (tr1/functional) like Elazar described it.