Subject: Re: [boost] tie alternative?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-10-28 09:49:40
>> OK, BOOST_FOREACH aside, iterating over a range returned as a pair of
>> iterators can be painful and ugly:
> I have encountered the same problem, but i am not sure why you would
> want to use anything but BOOST_FOREACH...
>> for (vertex_iterator pv,ve = xxx(pv,vertices(g)); pv != ve; ++pv)
> Moreover, in my opinion, the above construct seems a bit awkward to
> me. Modifying pv and pe at the same time, one as a function parameter,
> the other initialized with what the functions returns is a best very
> confusing. It's very clever, though, but again, why not use
> BOOST_FOREACH ?
> Another idea might be to directly use a pair of iterators by creating
> a special structure for "duplicate pairs"...
> for( duplicate_pair<vertex_iterator> vip( vertices( g ) ) ; vip.first
> != vip.second ; ++vip.first )
> I am not sure there's a real gain here though. Oh well. Can't blame me
> for trying ! :-)
FWIW, You can already today do
for( boost::iterator_range<vertex_iterator> vip( vertices( g ) ) ;
!vip.empty(); vip.advance_begin(1) )
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk