forked from boostorg/iterator
Documentation updates, added GNUMakefile for building
[SVN r20931]
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
.. Version 1.1 of this ReStructuredText document corresponds to
|
||||
n1530_, the paper accepted by the LWG for TR1.
|
||||
|
||||
.. Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
|
||||
rights reserved
|
||||
|
||||
|
||||
While the iterator interface is rich, there is a core subset of the
|
||||
interface that is necessary for all the functionality. We have
|
||||
identified the following core behaviors for iterators:
|
||||
@@ -31,7 +38,7 @@ objects for several reasons:
|
||||
3. Without the use of CRTP, the standard requirement that an
|
||||
iterator's ``operator++`` returns the iterator type itself means
|
||||
that all iterators generated by ``iterator_facade`` would be
|
||||
instantiations of ``iterator_facade``. Cumbersome type generator
|
||||
specializations of ``iterator_facade``. Cumbersome type generator
|
||||
metafunctions would be needed to build new parameterized
|
||||
iterators, and a separate ``iterator_adaptor`` layer would be
|
||||
impossible.
|
||||
@@ -40,7 +47,7 @@ Usage
|
||||
-----
|
||||
|
||||
The user of ``iterator_facade`` derives his iterator class from an
|
||||
instantiation of ``iterator_facade`` which takes the derived iterator
|
||||
specialization of ``iterator_facade`` which takes the derived iterator
|
||||
class as the first template parameter. The order of the other
|
||||
template parameters to ``iterator_facade`` have been carefully chosen
|
||||
to take advantage of useful defaults. For example, when defining a
|
||||
@@ -135,15 +142,15 @@ challenges. A random access iterator's ``operator[]`` is only
|
||||
required to return something convertible to its ``value_type``.
|
||||
Requiring that it return an lvalue would rule out currently-legal
|
||||
random-access iterators which hold the referenced value in a data
|
||||
member (e.g. `counting_iterator`__), because ``*(p+n)`` is a reference
|
||||
member (e.g. |counting|_), because ``*(p+n)`` is a reference
|
||||
into the temporary iterator ``p+n``, which is destroyed when
|
||||
``operator[]`` returns.
|
||||
|
||||
__ counting_iterator.html
|
||||
.. |counting| replace:: ``counting_iterator``
|
||||
|
||||
Writable iterators built with ``iterator_facade`` implement the
|
||||
semantics required by the preferred resolution to `issue 299`_ and
|
||||
adopted by proposal `n1477`_: the result of ``p[n]`` is a proxy object
|
||||
adopted by proposal n1550_: the result of ``p[n]`` is a proxy object
|
||||
containing a copy of ``p+n``, and ``p[n] = x`` is equivalent to ``*(p
|
||||
+ n) = x``. This approach will work properly for any random-access
|
||||
iterator regardless of the other details of its implementation. A
|
||||
@@ -152,9 +159,9 @@ to implement an ``operator[]`` which returns an lvalue in the derived
|
||||
iterator class; it will hide the one supplied by ``iterator_facade``
|
||||
from clients of her iterator.
|
||||
|
||||
.. _`n1477`: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1477.html
|
||||
.. _n1550: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html
|
||||
|
||||
.. _issue 299: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299
|
||||
.. _`issue 299`: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299
|
||||
|
||||
.. _`operator arrow`:
|
||||
|
||||
@@ -172,7 +179,7 @@ of the referenced value from its ``operator->``.
|
||||
|
||||
The return type for ``operator->`` and ``operator[]`` is not
|
||||
explicitly specified. Instead it requires each ``iterator_facade``
|
||||
instantiation to meet the requirements of its ``iterator_category``.
|
||||
specialization to meet the requirements of its ``iterator_category``.
|
||||
|
||||
|
||||
.. [Cop95] [Coplien, 1995] Coplien, J., Curiously Recurring Template
|
||||
|
Reference in New Issue
Block a user