22 Oct
2009
22 Oct
'09
1:17 p.m.
Sean Farrow wrote:
Hi:
Is it possible to use an std::pair with boost.foreach?
I’m 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