|
Boost Users : |
Subject: Re: [Boost-users] using pairs with boost.foreach
From: Eric Niebler (eric_at_[hidden])
Date: 2009-10-22 09:17:30
Sean Farrow wrote:
> Hi:
>
> Is it possible to use an std::pair with boost.foreach?
>
> Im getting all sorts of errors when trying to do this.
>
> Any help appreciated.
Do you mean using a std::pair of iterators to designate the range? That
should work. Or are you doing something like this:
BOOST_FOREACH( std::pair<X,Y> x, a_map ) // OOPS
The above won't work because the extra comma makes it look like you're
trying to pass 3 arguments to the BOOST_FOREACH macro. Try this:
typedef std::pair<X,Y> value_type;
BOOST_FOREACH( value_type x, a_map )
HTH,
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net