Boost logo

Boost Users :

Subject: Re: [Boost-users] Overloading boost::for_each()
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-08-29 20:06:17


On 29/08/2010 13:34, Mathias Gaunard wrote:

> I think the whole segmented iterators/ranges is a bad idea, as it has
> quite a few disadvantages and there are alternative, simpler solutions
> that provide the same benefits.
>
> segmented ranges have the following disadvantages:
>
> - any code or algorithm that deals with regular ranges has to be
> rewritten, not just in order to gain the performance gains, but to get
> basic functionality working as well. That's about as bad as it gets from
> an integration point of view.

I just re-read the paper (I had read it a long time ago), and it seems I
had missed an important element: a segmented iterator is still an
iterator, out of which you can extract the actual iterator of the
segments and the iterator of the data within a segment. (the terminology
makes it a bit confusing)

I thought the segmented iterator and the iterator of the segments were
the same thing, which is why I thought it wasn't a good solution:
passing the iterator to the segments to existing algorithms wouldn't
work; but with the approach as described in the paper, it will, and
segmented iterators are indeed a refinement of input iterators.

Algorithms written in terms of input iterators do not have to be
rewritten to work, since segmented iterators are input iterators with an
extra distinct iteration mode.


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