Move difference_type from the Forward Traversal Iterator concept to

the Single Pass Traversal concept, so that input iterators are still
input iterators.  It does make sense to measure the distance between
Single Pass iterators, provided you're willing to throw away the data.


[SVN r33870]
This commit is contained in:
Dave Abrahams
2006-04-30 03:35:16 +00:00
parent e2957cfb0c
commit 230d47e93a
4 changed files with 423 additions and 142 deletions

View File

@ -492,26 +492,30 @@ concept if the following expressions are valid and respect the stated
semantics.
+--------------------------------------------------------------------------------------------------------+
|Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality |
|Comparable) |
+--------------------------------+-----------------------------+-------------+---------------------------+
|Expression |Return Type | Operational |Assertion/ |
| | | Semantics |Pre-/Post-condition |
+================================+=============================+=============+===========================+
|``++r`` |``X&`` | |pre: ``r`` is |
| | | |dereferenceable; post: |
| | | |``r`` is dereferenceable or|
| | | |``r`` is past-the-end |
+--------------------------------+-----------------------------+-------------+---------------------------+
|``a == b`` |convertible to ``bool`` | |``==`` is an equivalence |
| | | |relation over its domain |
+--------------------------------+-----------------------------+-------------+---------------------------+
|``a != b`` |convertible to ``bool`` |``!(a == b)``| |
+--------------------------------+-----------------------------+-------------+---------------------------+
|``iterator_traversal<X>::type`` |Convertible to | | |
| |``single_pass_traversal_tag``| | |
+--------------------------------+-----------------------------+-------------+---------------------------+
+----------------------------------------------------------------------------------------------------------------+
|Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality Comparable) |
| |
+----------------------------------------+-----------------------------+-------------+---------------------------+
|Expression |Return Type | Operational |Assertion/ |
| | | Semantics |Pre-/Post-condition |
+========================================+=============================+=============+===========================+
|``++r`` |``X&`` | |pre: ``r`` is |
| | | |dereferenceable; post: |
| | | |``r`` is dereferenceable or|
| | | |``r`` is past-the-end |
+----------------------------------------+-----------------------------+-------------+---------------------------+
|``a == b`` |convertible to ``bool`` | |``==`` is an equivalence |
| | | |relation over its domain |
+----------------------------------------+-----------------------------+-------------+---------------------------+
|``a != b`` |convertible to ``bool`` |``!(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``| | |
+----------------------------------------+-----------------------------+-------------+---------------------------+
.. TR1: single_pass_iterator_tag changed to
single_pass_traversal_tag for consistency
@ -537,10 +541,6 @@ valid and respect the stated semantics.
| | |dereferenceable implies |
| | |``++r == ++s.`` |
+---------------------------------------+-----------------------------------+----------------------------+
|``iterator_traits<X>::difference_type``|A signed integral type representing| |
| |the distance between iterators | |
| | | |
+---------------------------------------+-----------------------------------+----------------------------+
|``iterator_traversal<X>::type`` |Convertible to | |
| |``forward_traversal_tag`` | |
+---------------------------------------+-----------------------------------+----------------------------+