Subject: Re: [boost] [iterator][range] BoostIteratorTraversalConcepts-aware boost::advance/distance
From: Ion GaztaÃ±aga (igaztanaga_at_[hidden])
Date: 2017-06-29 20:44:59
On 28/06/2017 22:14, Andrzej Krzemienski via Boost wrote:
> 2017-06-28 22:03 GMT+02:00 Michel Morin via Boost <boost_at_[hidden]>:
>> The Boost iterator traversal concepts have not been adopted by the C++
>> Because of this, some of RandomAccessTraversalIterators (Boost's concepts)
>> treated as InputIterators (Standard's concepts) by the stdlib.
>> IMHO, Boost.Iterator should provide BoostIteratorTraversalConcepts-aware
>> `boost::advance` and `boost::distance` to avoid the inefficiencies.
> Not just inefficiencies. Using `prev()` may simply cause UB. See here:
I would like to confirm something in your post. I think the standard
requires iterator_category to be one of the standard types, not
something derived from them:
Draft N4659 (2017/03) 27.4.2 Standard iterator tags
For every iterator of type Iterator,
iterator_traits<Iterator>::iterator_category shall be defined to be the
most specific category tag that describes the iteratorâs behavior
If this is correct, in your article is_BidirectionalIterator() should be
defined using is_same instead of is_base_of, and Boost.Iterator's
iterator_category definitions might not compatible with the standard. Or
am I missing something?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk