Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost users][tuple] foreach with tuple
From: pete_at_[hidden]
Date: 2009-08-04 11:37:57


>typedef vector<tuple<int,int> > vec_type;
>vec_type l_listLeftLines;
>foreach (vec_type::reference i_pair, l_listLeftLines)
>{...}

It is a bit of a pain to have to resort to the typedef. Because I iterate over std::maps quite a lot, I've semi-seriously toyed with the idea of a submitting a feature request for

BOOST_FOREACH_PAIR( std::pair<T1,T2> const& my_pair , my_container_with_a_pair_value_type )

which through a bit of PP_CAT and PP_COMMA somehow does the "right" thing. Given the potential for confusion though, I assumed Eric would reject the request :-).


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