Opened 9 years ago
Closed 7 years ago
#803 closed request (fixed)
use new iterator concepts
Reported by: | Peter | Owned by: | Peter |
---|---|---|---|
Priority: | major | Milestone: | yat 0.14 |
Component: | utility | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
Reading about the new iterator concepts http://www.boost.org/doc/libs/1_55_0/libs/iterator/doc/new-iter-concepts.html
it's obvious that we should replace the c++98 style categories with this new style. It will be more useful and backward compatible. Several things:
- we should replace usage of
std::iterator::tags
withboost::iterator_traversal_tags
e.g.boost::forward_traversal_tag
insteadstd::forward_iterator_tag
. This includes both- declarations of iterators as well as
- specializations in algorithms
- Concept Checks should be replaced with more specific Iterator Concepts provided by Boost::Iterator.
- In tests use boost iterator archetypes
Change History (48)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 9 years ago by
Status: | new → assigned |
---|
comment:3 Changed 9 years ago by
comment:5 Changed 9 years ago by
comment:6 Changed 9 years ago by
comment:7 Changed 9 years ago by
comment:9 Changed 9 years ago by
comment:10 Changed 9 years ago by
comment:11 Changed 9 years ago by
comment:12 Changed 9 years ago by
comment:13 Changed 9 years ago by
comment:19 Changed 9 years ago by
The std::random_access_iterator promises that iterator provides random traversal and that reference_type is an lvalue (i.e. not proxy). If reference_type is a proxy, it is therefore incorrect to tag the iterator with std::random_access_iterator. To reflect that we do the following two changes:
1) Container2DIterator now carries tag boost::random_access_traversal_tag rather than std::random_access_iterator. This means that in std:: speak a Container2DIterator is a random access iterator, if reference is an lvalue and an input iterator otherwise.
2) The BASE of StrideIterator? is no longer required to be a random access iterator, instead we require random access traversal. Therefore, StrideIterator? now uses the default tag rather than std::iterator_traits<BASE>::iterator_category. This means that the traversal tag is boost::random_access_traversal_tag (as BASE is required to provide random access traversal), and in std:: speak the same rule applies as for Container2DIterator.
3) The concept check for Container2D now requires that iterators ::const_iterator, ::const_row_iterator, ::const_column_iterator are readable iterator (the random access requirement is removed).
comment:20 Changed 9 years ago by
According to comment in boost ticket:1296 these the standard has lifted the reference requirement on forward iterators so there is no reason to mess around with traversal categories etc. Need to look into the details, but probably means that most of changes within this ticket should be reverted. At least docs should not mention these concepts and then concept_check should not use them either.
comment:21 Changed 9 years ago by
I got this reply on the boost list basically saying that is not true (yet), but that some people (read Eric Niebler) is lobbying for a change.
For yat that means, I'll go ahead with the change as outlined (in my head).
comment:22 Changed 8 years ago by
Milestone: | yat 0.13 → yat 0.14 |
---|
0.13 is already delayed and I don't think this ticket should block the release.
comment:23 Changed 8 years ago by
(In [3459]) utility::WeightedIterator? is now always tagged as std::input_iterator_tag. Previously it was inheriting the tag from DataIterator?, but did not implement what was promised in the tag - particuarly not having lvalue access. It continuous to support more advanced (e.g. random access) traversal if supported by underlying iterators and whether this is supported can be assessed with boost meta functions boost::iterator_traversal<>::type (see boost docs).
refs #803
comment:24 Changed 8 years ago by
comment:27 Changed 7 years ago by
comment:28 Changed 7 years ago by
comment:31 Changed 7 years ago by
comment:33 Changed 7 years ago by
comment:34 Changed 7 years ago by
comment:35 Changed 7 years ago by
comment:36 Changed 7 years ago by
In WeightIterator? and DataIterator? require that BASE models concept DataIterator? directly (rather than implicit requirements).
comment:37 Changed 7 years ago by
comment:38 Changed 7 years ago by
comment:40 Changed 7 years ago by
(In [3528]) refs #803. use new iterator concept in AveragerWeighted?
comment:42 Changed 7 years ago by
(In [3530]) refs #803. use new iterator concept in AveragerPairWeighted?
comment:43 Changed 7 years ago by
comment:44 Changed 7 years ago by
comment:45 Changed 7 years ago by
comment:46 Changed 7 years ago by
comment:47 Changed 7 years ago by
comment:48 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [3273]) refs #803. Extend iterator tests using boost concepts. For DataIterator? and WeightIterator? always make value_type double. Remove tests that DataIterator? and WeightIterator? are RandomAccessIterator? since they are not (always); instead check that they are readable and random access traversal iterators.