diff --git a/doc/new-iter-concepts.html b/doc/new-iter-concepts.html index f50727a..5901c3c 100755 --- a/doc/new-iter-concepts.html +++ b/doc/new-iter-concepts.html @@ -3,13 +3,291 @@
- +The standard iterator categories and requirements are flawed because they use a single hierarchy of concepts to address two orthogonal issues: iterator traversal and value access. As a result, many @@ -113,7 +391,7 @@ requirements in the iterator categories.
This proposal for TR1 is a pure extension. Further, the new iterator concepts are backward-compatible with the old iterator requirements, and old iterators are forward-compatible with the new iterator @@ -189,13 +467,13 @@ made it). -DWA --> standards conforming input iterator is allowed to have a tag that is not input_iterator_tag but that is convertible to input_iterator_tag? -JGS --> -
The extensions in this paper suggest several changes we might make to the working paper for the next standard. These changes are not a formal part of this proposal for TR1.
-The algorithms in the standard library could benefit from the new iterator concepts because the new concepts provide a more accurate way to express their type requirements. The result is algorithms that are @@ -239,7 +517,7 @@ Forward Iterator (2) -> Swappable Iterator and Incrementable Iterator
Bidirectional Iterator (1) -> Bidirectional Traversal Iterator and Readable Iterator, +
Bidirectional Iterator (1) -> Bidirectional Traversal Iterator and Readable Iterator, Bidirectional Iterator (2) -> Bidirectional Traversal Iterator and Writable Iterator
copy_backwards@@ -259,15 +537,15 @@ Bidirectional Iterator (2) -> Bidirectional Traversal Iterator and Writable I
For the next working paper (but not for TR1), the committee should consider deprecating the old iterator tags, and std::iterator_traits, since it will be superceded by individual traits metafunctions.
For the next working paper (but not for TR1), the committee should consider reclassifying vector<bool>::iterator as a Random Access Traversal Iterator and Readable Iterator and Writable @@ -275,8 +553,8 @@ Iterator.
The iterator requirements are to be separated into two groups. One set of concepts handles the syntax and semantics of value access:
The refinement relationships for the traversal concepts are in the following diagram.
-In addition to the iterator movement operators, such as
operator++, the traversal concepts also include requirements on
position comparison such as operator== and operator<. The
@@ -313,7 +591,7 @@ interoperable with int The relationship between the new iterator concepts and the old are
given in the following diagram. Like the old iterator requirements, we provide tags for purposes of
dispatching based on the traversal concepts. The tags are related via
inheritance so that a tag is convertible to another tag if the concept
@@ -346,19 +624,19 @@ only required to return something convertible to the i[n] = t (for a Writable Iterator).
In the tables below, X is an iterator type, a is a constant object of type X, R is std::iterator_traits<X>::reference, T is std::iterator_traits<X>::value_type, and v is a constant object of type T.
-A class or built-in type X models the Readable Iterator concept for value type T if, in addition to X being Assignable and Copy Constructible, the following expressions are valid and respect @@ -371,11 +649,11 @@ type T.
A class or built-in type X models the Writable Iterator concept if, in addition to X being Copy Constructible, the following expressions are valid and respect the stated semantics. Writable @@ -413,11 +691,11 @@ Iterators have an associated set of value types.
A class or built-in type X models the Swappable Iterator concept if, in addition to X being Copy Constructible, the following expressions are valid and respect the stated semantics.
@@ -442,11 +720,11 @@ expressions are valid and respect the stated semantics.The Lvalue Iterator concept adds the requirement that the return type of operator* type be a reference to the value type of the iterator.
@@ -473,11 +751,11 @@ iterator.In the tables below, X is an iterator type, a and b are constant objects of type X, r and s are mutable objects of type X, T is std::iterator_traits<X>::value_type, and v is a constant object of type T.
-A class or built-in type X models the Incrementable Iterator concept if, in addition to X being Assignable and Copy Constructible, the following expressions are valid and respect the @@ -516,11 +794,11 @@ stated semantics.
A class or built-in type X models the Single Pass Iterator concept if the following expressions are valid and respect the stated semantics.
Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality -Comparable) | +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality Comparable) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | -Return Type | -Operational + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | +Return Type | +Operational Semantics | -Assertion/ + | Assertion/ Pre-/Post-condition | !(a == b) | + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
iterator_traits<X>::difference_type | +A signed integral type +representing the distance +between iterators | ++ | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
iterator_traversal<X>::type | Convertible to single_pass_traversal_tag | @@ -606,8 +890,8 @@ relation over its domain -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Forward Traversal Iterator Requirements (in addition to Default Constructible and Single Pass Iterator) | +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Forward Traversal Iterator Requirements (in addition to Default Constructible and Single Pass Iterator) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | -Return Type | -Assertion/Note | +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | +Return Type | +Assertion/Note | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
iterator_traits<X>::difference_type | -A signed integral type representing -the distance between iterators | -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
iterator_traversal<X>::type | Convertible to forward_traversal_tag | @@ -653,8 +932,8 @@ the distance between iterators -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | -Return Type | -Operational + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | +Return Type | +Operational Semantics | -Assertion/ + | Assertion/ Pre-/Post-condition | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator) | +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | -Return Type | -Operational Semantics | -Assertion/ + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | +Return Type | +Operational Semantics | +Assertion/ Precondition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | -Return Type | -Assertion/Precondition/Postcondition | +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | +Return Type | +Assertion/Precondition/Postcondition | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | -Return Type | -Operational Semantics | -Assertion/ Precondition | +|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Expression | +Return Type | +Operational Semantics | +Assertion/ Precondition |