On Wed, Apr 6, 2011 at 3:03 PM, Mark Snelling <mark@bakedbeans.com> wrote:
Hi,

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::for_each( 
boost::adaptors::values( my_map), 
[]( const std::list< std::string >& my_list ) { boost::for_each( my_list, some_func ); } );

ideas anyone?

In the absence of C++0x lambdas I think you'd need something like Boost.Lambda, but I guess
that's probably not interoperable with the new range stuff for nested std algorithm invocations.

- Rob.