Boost logo

Boost :

Subject: Re: [boost] [range] fat iterators?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-11-12 11:38:26

On 12-11-2013 16:41, Eric Niebler wrote:

> 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.
> If anybody wants to take a peek, you can find the code here:
> I'm making no effort to maintain source compatibility, going instead
> with the design that seems right to me for C++11.

Good. I totally agree that r-value refs change things completely.

Some small comments (applies for transform_range as well):

A. For filter_range, you should inherit from the predicate if possible
to enable EBO. I don't know if lambdas complicate this?

B. For the constructor

    filter_range(Rng && rng, Pred pred)

then maybe it would be beneficial that empty predicates are constructed via

    filter_range(Rng && rng)

? I guess it needs benchmarking though, but the compiler will have to
elide a series of moves vs. default construct an empty class.

C. I can't quite figure out your use of filterer::filterer1. Do you
really have to store the predicate here also?


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