I thought this std::map key extraction into an std::vector should have worked without specifying --std=c++0x flag for gcc (4.6), but it did not. Any idea why?
template <typename Map, typename Container>
void extract_map_keys(const Map& m, Container& c) {
struct get_key {
typename Map::key_type operator()
(const typename Map::value_type& p) const {
return p.first;
}
};
transform(m.begin(), m.end(), back_inserter(c), get_key());
}
Thanks!