Hello All,
The documentation of [Single Pass Range][1] in Boost.Range says that
there should be both `iterator` and `const_iterator` associated types
and both const and non-const overloads for `begin` and `end`. However if
it is really a single-pass range, I don't see a way to implement a
`const_iterator` that would work on `const` reference to the range,
because the `operator++` of the iterator involves calling a non-const
method of the range.
For example the `std::istream_iterator::operator++` calls
`std::istream::operator>>`, which is non-const and so there is no
`const_istream_iterator`. The `istream_range` cheats around this a
little, because the range
is a wrapper around the stream, not the stream itself. But when I have
similarly behaving class that I can make itself be a range, do I really
have to work around this using a wrapper, or can the requirement be
relaxed in practice?
[1]:
http://www.boost.org/libs/range/doc/html/range/concepts/single_pass_range.ht...
--
Jan Hudec