Boost logo

Boost :

Subject: Re: [boost] [range] fat iterators?
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2013-11-12 11:21:11

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".
But it is possible to do only one comparison per iteration, like :

     cout << *it << " ";

We can have new fast algorithms for such iterators. Such iterators are
not replacement of STL iterators, but complementary. It is OK to have
different iterators and different algorithms for different kinds of
things -;t=42m18s .
Plus, when backward compatibility matters - we can use adaptors like you

Evgeny Panasyuk

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