From 84f22cde8d536799bc54710ae7602d93d2e240bf Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Tue, 16 Dec 2003 22:15:48 +0000 Subject: [PATCH] a little progress with indirect iterator [SVN r21294] --- doc/facade-and-adaptor.html | 259 +++++----------------------------- doc/indirect_iterator_ref.rst | 4 +- doc/iter-issue-list.rst | 104 +++++++++++++- 3 files changed, 138 insertions(+), 229 deletions(-) diff --git a/doc/facade-and-adaptor.html b/doc/facade-and-adaptor.html index 1521731..e171bcf 100755 --- a/doc/facade-and-adaptor.html +++ b/doc/facade-and-adaptor.html @@ -3,203 +3,12 @@ - + Iterator Facade and Adaptor - +
@@ -510,7 +319,7 @@ of the derived iterator type. These member functions are described briefly below and in more detail in the iterator facade requirements.

- +
@@ -903,7 +712,7 @@ object of type X, X, and z is a constant object of a random access traversal iterator type interoperable with X.

-
+
@@ -1442,25 +1251,32 @@ iterators over smart pointers, which the impl handles. -JGS --> template < class Iterator , class Value = use_default - , unsigned Access = use_default_access - , class Traversal = use_default + , class CategoryOrTraversal = use_default , class Reference = use_default , class Difference = use_default > class indirect_iterator - : public iterator_adaptor</* see discussion */> + : public iterator_adaptor< + indirect_iterator<Iterator, Value, Access, Traversal, + Reference, Difference>, + Iterator, + /* Value = see below */, + CategoryOrTraversal, + Reference, + Difference> { friend class iterator_core_access; public: indirect_iterator(); indirect_iterator(Iterator x); + template < - class Iterator2, class Value2, unsigned Access2, class Traversal2 + class Iterator2, class Value2, class Category2 , class Reference2, class Difference2 > indirect_iterator( indirect_iterator< - Iterator2, Value2, Access2, Traversal2, Reference2, Difference2 + Iterator2, Value2, Category2, Reference2, Difference2 > const& y , typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition ); @@ -1474,29 +1290,27 @@ private: // as-if specification

indirect_iterator requirements

-

The value_type of the Iterator template parameter should -itself be dereferenceable. The return type of the operator* for -the value_type must be the same type as the Reference template -parameter. The Value template parameter will be the value_type -for the indirect_iterator, unless Value is const. If Value -is const X, then value_type will be non- const X. The -default for Value is

+

The following requirements are placed on the type +iterator_traits<Iterator>::value_type. Let i be an object of +type iterator_traits<Iterator>::value_type. Then *i must be a +valid expression, and the type of *i must be the same as the +Reference template parameter.

+

The Value template parameter will be the value_type for the +indirect_iterator, unless Value is cv-qualified. If Value +is cv-qualified then value_type will be non-qualified version of +the type. The default for Value is

 iterator_traits< iterator_traits<Iterator>::value_type >::value_type
 

If the default is used for Value, then there must be a valid specialization of iterator_traits for the value type of the base iterator.

-

The Reference parameter will be the reference type of the -indirect_iterator. The default is Value&.

-

The Access and Traversal parameters are passed unchanged to -the corresponding parameters of the iterator_adaptor base -class, and the Iterator parameter is passed unchanged as the -Base parameter to the iterator_adaptor base class.

+

The indirect iterator will model the most refined standard traversal -concept that is modeled by the Iterator type. The indirect -iterator will model the most refined standard access concept that is -modeled by the value type of Iterator.

+concept that is modeled by the Iterator type and that refines the +traversal category specified in the CategoryOrTraversal parameter. +The indirect iterator will model the most refined standard access +concept that is modeled by the value type of Iterator.

indirect_iterator operations

@@ -1507,8 +1321,8 @@ modeled by the value type of Iterator
- +
Requires:Iterator must be Default Constructible.
Returns:An instance of indirect_iterator with -a default constructed base object.
Returns:An instance of indirect_iterator with +a default-constructed iterator_adaptor subobject.
@@ -1540,7 +1354,8 @@ indirect_iterator( Requires:Iterator2 is implicitly convertible to Iterator. -Returns:An instance of indirect_iterator that is a copy of y. +Returns:An instance of indirect_iterator whose +iterator_adaptor subobject is constructed from y.base(). @@ -2131,11 +1946,5 @@ LocalWords: OtherIncrementable Coplien -->
- - diff --git a/doc/indirect_iterator_ref.rst b/doc/indirect_iterator_ref.rst index 0a35c90..4d30b2f 100644 --- a/doc/indirect_iterator_ref.rst +++ b/doc/indirect_iterator_ref.rst @@ -10,7 +10,7 @@ class indirect_iterator : public iterator_adaptor< indirect_iterator, + Reference, Difference>, Iterator, /* Value = see below */, CategoryOrTraversal, @@ -101,6 +101,6 @@ concept that is modeled by the value type of ``Iterator``. :Requires: ``Iterator2`` is implicitly convertible to ``Iterator``. :Returns: An instance of ``indirect_iterator`` whose -``iterator_adaptor`` subobject is constructed from ``y.base()``. + ``iterator_adaptor`` subobject is constructed from ``y.base()``. diff --git a/doc/iter-issue-list.rst b/doc/iter-issue-list.rst index 664a3d0..bfc9c3f 100644 --- a/doc/iter-issue-list.rst +++ b/doc/iter-issue-list.rst @@ -52,7 +52,8 @@ specific values. Is there a reason for iterator_access to be more specific? Resolution ---------- - The iterator_access enum has been removed, so this is no longer an issue. + +The iterator_access enum has been removed, so this is no longer an issue. @@ -267,6 +268,22 @@ argument's contained Iterator object should be converted to the target type's Iterator type. Is that what's meant here? +Resolution +---------- + +1. As suggested, change the returns clause to read: + +:Returns: An instance of ``indirect_iterator`` with a default-constructed + ``iterator_adaptor`` subobject. + + +2. Basically, yes. The return clause should be changed to: + +:Returns: An instance of ``indirect_iterator`` whose + ``iterator_adaptor`` subobject is constructed from ``y.base()``. + + + Subject: N1530: enable_if_convertible conflicts with requires ============================================================= Date: Wed, 12 Nov 2003 15:09:48 -0500 @@ -389,8 +406,12 @@ iterator_facade, but does not provide the 'b' versions of these functions. Are the 'b' versions needed? + +Subject: Re: Proposed revision of N1550 +======================================= +From: Pete Becker +Date: Wed, 03 Dec 2003 13:36:26 -0500 Message c++std-lib-12566 -======================== The footnote says: @@ -703,6 +724,10 @@ Date: Tue, 09 Dec 2003 13:35:20 -0500 From: Pete Becker Message c++std-lib-12640 + +Part 1 +------ + >The value_type of the Iterator template parameter should itself be >dereferenceable. The return type of the operator* for the value_type must >be the same type as the Reference template parameter. @@ -714,6 +739,25 @@ iterator_traits::value_type must be dereferenceable. The Reference template parameter must be the same type as *iterator_traits::value_type(). + +Resolution +---------- + +I don't think we want to require default constructible for +``iterator_traits::value_type``, so I've reworded to avoid +that implication. + +Change the text to: + +The following requirements are placed on the type +``iterator_traits::value_type``. Let ``i`` be an object of +type ``iterator_traits::value_type``. Then ``*i`` must be a +valid expression, and the type of ``*i`` must be the same as the +``Reference`` template parameter. + +Part 2 +------ + >The Value template parameter will be the value_type for the >indirect_iterator, unless Value is const. If Value is const X, then >value_type will be non- const X. @@ -721,6 +765,23 @@ The Reference template parameter must be the same type as Also non-volatile, right? In other words, if Value isn't use_default, it just gets passed as the Value argument for iterator_adaptor. + +Resolution +---------- + +Yes, I think that's right. Dave, can you confirm? + +Here's the rewording: + +The ``Value`` template parameter will be the ``value_type`` for the +``indirect_iterator``, unless ``Value`` is cv-qualified. If ``Value`` +is cv-qualified then ``value_type`` will be non-qualified version of +the type. + + +Part 3 +------ + >The default for Value is > >iterator_traits< iterator_traits::value_type >::value_type @@ -734,6 +795,16 @@ pun, or is iterator_traits::value_type required to be some form of iterator? If it's the former we need to find a different way to say it. If it's the latter we need to say so. + +Resolution +---------- + +Dave, help! + + +Part 4 +------ + >The Reference parameter will be the reference type of the >indirect_iterator. The default is Value&. @@ -741,6 +812,15 @@ That is, the Reference parameter is passed unchanged as the Reference argument to iterator_adaptor. Which is what it should say, instead of repeating what iterator_adaptor does. +Resolution +---------- + +Yes. + + +Part 5 +------ + >The Access and Traversal parameters are passed unchanged to the >corresponding parameters of the iterator_adaptor base class, and the >Iterator parameter is passed unchanged as the Base parameter to the @@ -766,6 +846,15 @@ Reference, Difference>, Reference, Difference> +Resolution +---------- + +Yes. + + +Part 6 +------ + >The indirect iterator will model the most refined standard traversal >concept that is modeled by the Iterator type. The indirect iterator will >model the most refined standard access concept that is modeled by the @@ -777,6 +866,17 @@ most refined types are available, but iterator_traits::iterator_category won't reflect those capabilities. +Resolution +---------- + +The indirect iterator will model the most refined standard traversal +concept that is modeled by the ``Iterator`` type and that refines the +traversal category specified in the ``CategoryOrTraversal`` parameter. +The indirect iterator will model the most refined standard access +concept that is modeled by the value type of ``Iterator``. + +.. I am not confident in the above. -JGS + Subject: N1530: transform_iterator requirements ===============================================