Opened 14 years ago
Last modified 7 years ago
#2539 new Bugs
advance() and distance() for new iterator concepts
Reported by: | Owned by: | jeffrey.hellrung | |
---|---|---|---|
Milestone: | Boost 1.38.0 | Component: | iterator |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I can't find a trace of a problem submitted by Sebastian Redl last year : http://lists.boost.org/Archives/boost/2007/09/127785.php
In brief, the std version of advance() and distance() functions does not dispatch accordingly to the traversal_tag. For instance a transform_iterator is categorized as std::input_iterator_tag, boost::random_access_traversal_tag and the chosen distance() implementation is O(n) while O(1) is expected.
The patch suggested by Sebastian works fine. The only thing is that names collides with Boost.Range (which already have boost::distance).
Change History (4)
comment:1 by , 13 years ago
Component: | None → iterator |
---|---|
Owner: | set to |
comment:2 by , 13 years ago
comment:3 by , 10 years ago
Owner: | changed from | to
---|
comment:4 by , 7 years ago
My business partners wanted DA 31 earlier today and encountered a great service that hosts a searchable forms database . If you require DA 31 too , here's http://goo.gl/3IWMJu
Any update on this? I would like to add that this is not simply a effeciency issue, it leads to erroneous behavior if a boost iterator is used with std::advance and if nothing else there should be a strong warning in the documentation, i.e. the following test fails std::advance(some_boost_iterator.end(), -1) != some_boost_iterator.end().
Simple test,