Boost logo

Boost :

Subject: Re: [boost] [range] fat iterators?
From: Eric Niebler (eniebler_at_[hidden])
Date: 2013-11-12 13:59:13

On 11/12/2013 10:44 AM, Daniel James wrote:
> On 12 November 2013 17:13, Eric Niebler <eniebler_at_[hidden]> wrote:
>> On 11/12/2013 8:21 AM, Evgeny Panasyuk wrote:
>>> 12.11.2013 19:41, Eric Niebler:
>>>> I've now built a filter_range, transform_range, and an
>>>> istream_range in this vein. Initial results are looking promising,
>>>> but I haven't benchmarked performance, yet. A commenter on my blog
>>>> claims to have benchmarked perf of istream_range, with good
>>>> results, which is encouraging.
>>> While new "slim" istream_range is faster than version with "fat"
>>> iterators, it is still not the fastest possible. In particular, it
>>> does two comparisons per cycle iteration: one is "!rng_->next()", and
>>> another is comparison of iterators, like "it != last".
>> <snip>
>> The commenter on my blog claims this extra check is optimized away by a
>> smart compiler like gcc. He says[^1]:
> Regardless of efficiency, a range adaptor could make implementing
> input and forward ranges much easier.

Agreed. I've implemented such an adaptor, but I'm not yet happy with it
so I haven't committed it yet. I think we can take a page out of
Boost.Iterator's book and have range_adaptor and range_facade. With some
thought, we should have a good answer for the folks who just want to
write something like the D range interface.

Eric Niebler

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