$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Constant iterator of Single Pass Range
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2014-05-06 15:59:44
> All containers are at least forward ranges, not merely single pass ones.
> Since iterating a forward range does not change it, there is no problem
> for it
> to have a `const` `begin()` and `end()` methods (returning const
> iterators).
>
> What I had issue with is single pass range. Consider something that behaves
> like `std::istream`. The `std::istream_iterator` can be only constructed
> from
> non-const reference to `std::istream`, because the
> `std::istream_iterator::operator++` (and the constructor itself) call the
> `std::istream::operator>>`, which is non-const.
I have exactly the same problem. The iterator approach to treat the
range as a pair of iterators is not sufficient for me, since it bloats
the last iterator. I would like to store all informations in the range
and just pass pointers to the range to the iterators, like Erik Niebler
explains in his posts single pass ranges.