The problem is in value_type
. std::map<int, std::string>::value_type
is not std::pair<int, std::string>
it is std::map<const int, std::string>
So once I changed the code to
std::copy(
boost::make_transform_iterator(map.begin(),
boost::bind(&std::pair<const int, std::string>::second, _1)),
boost::make_transform_iterator(map.end(),
boost::bind(&std::pair<const int, std::string>::second, _1)),
std::back_inserter(list));
It worked