$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] tie alternative?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-10-28 17:24:43
David Abrahams skrev:
> on Tue Oct 28 2008, Thorsten Ottosen <thorsten.ottosen-AT-dezide.com> wrote:
>
>> Benoit skrev:
>>> 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) )
>
> It's sad, but I'm not as confident in the ability to optimize that form
> because the iterators are bundled into a single struct. Also I am not
> fond of the constant 1.
I haven't tried on a new compiler (only vc8), but it is quite sad that
compilers can't optimize std::advance(i,1) into ++i.
-Thorsten