Boost logo

Boost :

Subject: Re: [boost] [Foreach] Proposal to simplify using Boost.Foreach with maps
From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2009-09-14 03:05:38


Chris Purcell <chris.purcell.39 <at> gmail.com> writes:

>
> As documented in the manual ("Pitfalls"), BOOST_FOREACH is a little
> awkward to use with associative containers. I've used the following in
> the past to simplify my own code, and wondered if it was suitable to
> add to the Boost Foreach library proper.
>
> std::map<int, int> my_map;
> BOOST_FOREACH_PAIR(int key, int value, my_map)
> std::cout << key << " : " << value << "\n";

Can you provide a link to the code?
I'd like to test it.

Markus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk