A few fixes

[SVN r23542]
This commit is contained in:
Dave Abrahams
2004-07-14 12:33:36 +00:00
parent 539add7de6
commit 2241bb1ae3
23 changed files with 424 additions and 182 deletions

View File

@ -412,8 +412,9 @@ expressions are valid and respect the stated semantics.
| | |exchanged |
+-------------------------+-------------+-----------------------------+
[*Note:* An iterator that is a model of the *Readable* and *Writable Iterator* concepts
is also a model of *Swappable Iterator*. *--end note*]
[*Note:* An iterator that is a model of the `Readable Iterator`_ and
`Writable Iterator`_ concepts is also a model of *Swappable
Iterator*. *--end note*]
Lvalue Iterators [lib.lvalue.iterators]
@ -432,15 +433,13 @@ iterator.
| | |``iterator_traits<X>::value_type`` |
| | |where *cv* is an optional |
| | |cv-qualification. pre: ``a`` is |
| | |dereferenceable. If ``X`` is a |
| | |*Writable Iterator* then ``a == b``|
| | |if and only if ``*a`` is the same |
| | |object as ``*b``. If ``X`` is a |
| | |*Readable Iterator* then ``a == b``|
| | |implies ``*a`` is the same object |
| | |as ``*b``. |
| | |dereferenceable. |
+-------------+-----------+-----------------------------------+
If ``X`` is a `Writable Iterator`_ then ``a == b`` if and only if
``*a`` is the same object as ``*b``. If ``X`` is a `Readable
Iterator`_ then ``a == b`` implies ``*a`` is the same object as
``*b``.
Iterator Traversal Concepts [lib.iterator.traversal]
@ -451,7 +450,6 @@ 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``.
Incrementable Iterators [lib.incrementable.iterators]
-----------------------------------------------------
@ -460,32 +458,28 @@ concept if, in addition to ``X`` being Assignable and Copy
Constructible, the following expressions are valid and respect the
stated semantics.
+------------------------------------------------------------------------------------+
|Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) |
| |
+--------------------------------+-------------------------------+-------------------+
|Expression |Return Type |Assertion |
+================================+===============================+===================+
|``++r`` |``X&`` |``&r == &++r`` |
+--------------------------------+-------------------------------+-------------------+
|``r++`` | | |
+--------------------------------+-------------------------------+-------------------+
|``*r++`` | | |
+--------------------------------+-------------------------------+-------------------+
|``iterator_traversal<X>::type`` |Convertible to | |
| |``incrementable_traversal_tag``| |
+--------------------------------+-------------------------------+-------------------+
+----------------------------------------------------------------------------------------+
|Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) |
| |
+--------------------------------+-------------------------------+-----------------------+
|Expression |Return Type |Assertion/Semantics |
+================================+===============================+=======================+
|``++r`` |``X&`` |``&r == &++r`` |
+--------------------------------+-------------------------------+-----------------------+
|``r++`` |convertible to ``const X&`` |``X a(r++);`` is |
| | |equivalent to ``X a(r);|
| | |++r;`` |
+--------------------------------+-------------------------------+-----------------------+
|``*r++`` |if ``X`` is a *Readable |If ``X`` is a *Readable|
| |Iterator* then ``T`` |Iterator* then ``T |
| | |z(*r++);`` is |
| | |equivalent to ``T |
| | |z(*r); ++r;``. If ``X``|
| | |is a *Writable |
| | |Iterator* then ``*r++ =|
| | |o`` is equivalent to |
| | |``*r = o; ++r``. |
+--------------------------------+-------------------------------+-----------------------+
|``iterator_traversal<X>::type`` |Convertible to | |
| |``incrementable_traversal_tag``| |
+--------------------------------+-------------------------------+-----------------------+
If ``X`` is a `Writable Iterator`_ then ``X a(r++);`` is equivalent
to ``X a(r); ++r;`` and ``*r++ = o`` is equivalent
to ``*r = o; ++r``.
If ``X`` is a `Readable Iterator`_ then ``T z(*r++);`` is equivalent
to ``T z(*r); ++r;``.
.. TR1: incrementable_iterator_tag changed to
incrementable_traversal_tag for consistency.
@ -498,26 +492,26 @@ 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 |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_traversal<X>::type`` |Convertible to | | |
| |``single_pass_traversal_tag``| | |
+--------------------------------+-----------------------------+-------------+---------------------------+
.. TR1: single_pass_iterator_tag changed to
single_pass_traversal_tag for consistency
@ -565,35 +559,36 @@ Iterator* concept if, in addition to ``X`` meeting the requirements of
Forward Traversal Iterator, the following expressions are valid and
respect the stated semantics.
+--------------------------------------------------------------------------------------+
|Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal |
|Iterator) |
+--------------------------------+-------------------------------+---------------------+
|Expression |Return Type |Assertion/Semantics /|
| | |Pre-/Post-condition |
+================================+===============================+=====================+
|``--r`` |``X&`` |pre: there exists |
| | |``s`` such that ``r |
| | |== ++s``. post: |
| | |``s`` is |
| | |dereferenceable. |
| | |``--(++r) == r``. |
| | |``--r == --s`` |
| | |implies ``r == |
| | |s``. ``&r == &--r``. |
+--------------------------------+-------------------------------+---------------------+
|``r--`` |convertible to ``const X&`` |:: |
| | | |
| | | { |
| | | X tmp = r; |
| | | --r; |
| | | return tmp; |
| | | } |
+--------------------------------+-------------------------------+---------------------+
|``iterator_traversal<X>::type`` |Convertible to | |
| |``bidirectional_traversal_tag``| |
| | | |
+--------------------------------+-------------------------------+---------------------+
+-----------------------------------------------------------------------------------------------------+
|Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal |
|Iterator) |
+--------------------------------+-------------------------------+--------------+---------------------+
|Expression |Return Type | Operational |Assertion/ |
| | | Semantics |Pre-/Post-condition |
+================================+===============================+==============+=====================+
|``--r`` |``X&`` | |pre: there exists |
| | | |``s`` such that ``r |
| | | |== ++s``. post: |
| | | |``s`` is |
| | | |dereferenceable. |
| | | | |
| | | |``++(--r) == r``. |
| | | |``--r == --s`` |
| | | |implies ``r == |
| | | |s``. ``&r == &--r``. |
+--------------------------------+-------------------------------+--------------+---------------------+
|``r--`` |convertible to ``const X&`` |:: | |
| | | | |
| | | { | |
| | | X tmp = r; | |
| | | --r; | |
| | | return tmp;| |
| | | } | |
+--------------------------------+-------------------------------+--------------+---------------------+
|``iterator_traversal<X>::type`` |Convertible to | | |
| |``bidirectional_traversal_tag``| | |
| | | | |
+--------------------------------+-------------------------------+--------------+---------------------+
.. TR1: bidirectional_traversal_iterator_tag changed to
bidirectional_traversal_tag for consistency
@ -642,11 +637,11 @@ constant object of type ``Distance``.
| | | |``a + n == b``. ``b |
| | | |== a + (b - a)``. |
+-------------------------------+---------------------------------+-------------------------+----------------------+
|``a[n]`` |convertible to T |``*(a + n)`` |pre: a is a `readable |
| | | |iterator`_ |
|``a[n]`` |convertible to T |``*(a + n)`` |pre: a is a `Readable |
| | | |Iterator`_ |
+-------------------------------+---------------------------------+-------------------------+----------------------+
|``a[n] = v`` |convertible to T |``*(a + n) = v`` |pre: a is a `writable |
| | | |iterator`_ |
|``a[n] = v`` |convertible to T |``*(a + n) = v`` |pre: a is a `Writable |
| | | |Iterator`_ |
+-------------------------------+---------------------------------+-------------------------+----------------------+
|``a < b`` |convertible to ``bool`` |``b - a > 0`` |``<`` is a total |
| | | |ordering relation |