Does anyone know if there\'s a de-facto standard (i.e., TR1 or Boost) C++ function object for accessing the elements of a std::pair? Twice in the past 24 hours I\'ve wished
boost::bind is often used to adapt std::map containers for use with algorithms. Here is an example:
void print_string(const std::string& s) {
std::cout << s << '\n';
}
std::map my_map;
my_map[0]="Boost";
my_map[1]="Bind";
std::for_each(my_map.begin(), my_map.end(),
boost::bind(&print_string, boost::bind(
&std::map::value_type::second,_1)));