
15 Apr
2009
15 Apr
'09
4:02 p.m.
Peter Dimov wrote:
Noah Roberts:
// won't compile: std::transform(m.begin(), m.end(), keys.begin(), boost::bind(&std::pair<std::string,Test>::first, _1));
The value type of the map m is pair<string const, Test> - note the const. Use the value_type typedef:
typedef std::map<std::string, Test> map_type;
std::transform( m.begin(), m.end(), keys.begin(), boost::bind(&map_type::value_type::first, _1) );
It would be something basic. Thanks.