Boost logo

Boost :

Subject: Re: [boost] tie alternative?
From: Benoit (benoit.casoetto_at_[hidden])
Date: 2008-10-28 01:51:06

> 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

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 ! :-)


Boost list run by bdawes at, gregod at, cpdaniel at, john at