Boost logo

Boost Users :

Subject: [Boost-users] [range] for_each and std::map of std::list
From: Mark Snelling (mark_at_[hidden])
Date: 2011-04-06 10:03:52


Consider a map defined as...

std::map< int, std::list< std::string > > my_map;

I'm wondering if/how it's possible to use Boost.Range to call a function on
each std::string in each of the lists contained in the map. I have an
implementation below which works using a C++0x lambda function but am
curious if this can be done purely using Boost.Range?

boost::adaptors::values( my_map),
[]( const std::list< std::string >& my_list ) { boost::for_each( my_list,
some_func ); } );

ideas anyone?

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at