From 11770763df96588bd08d14208c37bab905569f33 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Tue, 13 Jan 2004 19:35:41 +0000 Subject: [PATCH] a couple small edits to the iterator adaptor tutorial [SVN r21700] --- doc/iterator_adaptor.html | 16 ++++++++++------ doc/iterator_adaptor_tutorial.rst | 18 ++++++++++++------ doc/new-iter-concepts.html | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/doc/iterator_adaptor.html b/doc/iterator_adaptor.html index 78885df..62e516a 100644 --- a/doc/iterator_adaptor.html +++ b/doc/iterator_adaptor.html @@ -348,17 +348,19 @@ to who-knows-where? The most we can do with that incremented position is to compare another node_base* to it. In other words, the original iterator traverses a one-element array.

-

You probably didn't think of it that way, but the node_base* +

You probably didn't think of it this way, but the node_base* object which underlies node_iterator is itself an iterator, just like all other pointers. If we examine that pointer closely from an iterator perspective, we can see that it has much in common with the node_iterator we're building. First, they share most of the same associated types (value_type, reference, -pointer, and difference_type). Second, even much of the +pointer, and difference_type). Second, even some of the core functionality is the same: operator* and operator== on -the node_iterator just return the result of invoking the same +the node_iterator return the result of invoking the same operations on the underlying pointer, via the node_iterator's -dereference and equal member functions)

+dereference and equal member functions). However, the operator++ for +node_iterator behaves differently than for node_base* +since it follows the m_next pointer.

It turns out that the pattern of building an iterator on another iterator-like type (the Base 1 type) while modifying just a few aspects of the underlying type's behavior is an @@ -430,13 +432,15 @@ std::iterator_traits<Iterator>::some-associated-type reverse_iterator and the other Boost specialized iterator adaptors to get an idea of the sorts of things you can do with iterator_adaptor. In particular, have a look at -counting_iterator, which demonstrates that iterator_adaptor's Base type needn't be an iterator.

+transform_iterator, which is perhaps the most straightforward +adaptor, and also counting_iterator, which demonstrates that +iterator_adaptor's Base type needn't be an iterator.

diff --git a/doc/iterator_adaptor_tutorial.rst b/doc/iterator_adaptor_tutorial.rst index 9aa6552..ed1aa7e 100755 --- a/doc/iterator_adaptor_tutorial.rst +++ b/doc/iterator_adaptor_tutorial.rst @@ -20,17 +20,19 @@ we're going to pick up right where it left off. position is to compare another ``node_base*`` to it. In other words, the original iterator traverses a one-element array. -You probably didn't think of it that way, but the ``node_base*`` +You probably didn't think of it this way, but the ``node_base*`` object which underlies ``node_iterator`` is itself an iterator, just like all other pointers. If we examine that pointer closely from an iterator perspective, we can see that it has much in common with the ``node_iterator`` we're building. First, they share most of the same associated types (``value_type``, ``reference``, -``pointer``, and ``difference_type``). Second, even much of the +``pointer``, and ``difference_type``). Second, even some of the core functionality is the same: ``operator*`` and ``operator==`` on -the ``node_iterator`` just return the result of invoking the same +the ``node_iterator`` return the result of invoking the same operations on the underlying pointer, via the ``node_iterator``\ 's -|dereference_and_equal|_) +|dereference_and_equal|_). However, the ``operator++`` for +``node_iterator`` behaves differently than for ``node_base*`` +since it follows the ``m_next`` pointer. .. |dereference_and_equal| replace:: ``dereference`` and ``equal`` member functions .. _dereference_and_equal: iterator_facade.html#implementing-the-core-operations @@ -112,8 +114,9 @@ We urge you to review the documentation and implementations of |reverse_iterator|_ and the other Boost `specialized iterator adaptors`__ to get an idea of the sorts of things you can do with ``iterator_adaptor``. In particular, have a look at -|counting_iterator|_, which demonstrates that ``iterator_adaptor``\ -'s ``Base`` type needn't be an iterator. +|transform_iterator|_, which is perhaps the most straightforward +adaptor, and also |counting_iterator|_, which demonstrates that +``iterator_adaptor``\ 's ``Base`` type needn't be an iterator. .. |reverse_iterator| replace:: ``reverse_iterator`` .. _reverse_iterator: reverse_iterator.html @@ -121,5 +124,8 @@ adaptors`__ to get an idea of the sorts of things you can do with .. |counting_iterator| replace:: ``counting_iterator`` .. _counting_iterator: counting_iterator.html +.. |transform_iterator| replace:: ``transform_iterator`` +.. _transform_iterator: transform_iterator.html + __ index.html#specialized-adaptors diff --git a/doc/new-iter-concepts.html b/doc/new-iter-concepts.html index 3dd2d53..a664d40 100755 --- a/doc/new-iter-concepts.html +++ b/doc/new-iter-concepts.html @@ -1023,7 +1023,7 @@ LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->