On 8/28/2014 3:49 PM, Neil Groves wrote:
> On 28 August 2014 22:35, Krzysztof Czainski wrote:standard iterator categories), iterator *traversal* deals only with
>I see no conflated requirements. In Boost.Iterators (as opposed to the
traversal (++, --, +=, -=, etc) and says nothing about the return type
of the dereference operation.
Krzysztof is right, though. The dereference operation should return an
rvalue. That would make the counting_iterator a Readable iterator in the
new-style categories. "Readable" is orthogonal to the iterator traversal.
So IMO, counting_iterator should be a Readable Iterator and a Random
Access Traversal Iterator. When this is mapped to one of the standard
iterator categories, it becomes std::input_iterator_tag (because of the
requirements on Forward Iterators in the standard).
No, I think this is a bug, plain and simple. Fixing it is likely to
> I imagine that this is why the counting_iterator is implemented to
> return a true reference.
cause trouble though. :-(
If Boost.Range were made aware of the Boost new-style iterator
> This leaves us with rather a thorny problem, a counting_iterator
> can't have the dereference operator return by value and model the
> Bidirectional Iterator Concept. Therefore if counting_iterator were
> to return by value we wouldn't be allowed to reverse (if we
> constrained ourselves to the Standard iterator traversal categories).
> It might be that there is room for improvement while working with the
> Boost traversal tags rather than the iterator traversal tags.
categories -- which make traversal and access independent -- the
reversed view could still work with counting_iterator. The resulting
view's iterators would also be Random Access Traversal and Readable.
Making all of Boost.Range aware of the new-style iterators would be a
piece of work, though.
Indeed. Please include this discussion in the bug report.
> Thanks for pointing this out, I hadn't spotted this issue with the
> counting_iterator. After giving this some more thought I shall raise
> a ticket for Boost.Iterator.
Eric