mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-19 23:52:12 +02:00
a couple small edits to the iterator facade tutorial
[SVN r21620]
This commit is contained in:
@ -75,11 +75,29 @@ lists.
|
||||
A Basic Iterator Using ``iterator_facade``
|
||||
------------------------------------------
|
||||
|
||||
Template Parameters
|
||||
...................
|
||||
We will construct a ``node_iterator`` class using inheritance from
|
||||
``iterator_facade`` to implement most of the iterator's operations.
|
||||
|
||||
::
|
||||
|
||||
# include "node.hpp"
|
||||
# include <boost/iterator/iterator_facade.hpp>
|
||||
|
||||
class node_iterator
|
||||
: public boost::iterator_facade<...>
|
||||
{
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
|
||||
Template Arguments for ``iterator_facade``
|
||||
..........................................
|
||||
|
||||
``iterator_facade`` has several template parameters, so we must decide
|
||||
what types to use for the arguments. The parameters are ``Derived``,
|
||||
``Value``, ``CategoryOrTraversal``, ``Reference``, and ``Difference``.
|
||||
|
||||
The first step in building a concrete iterator with iterator_facade
|
||||
is to decide what its template parameters will be.
|
||||
|
||||
``Derived``
|
||||
'''''''''''
|
||||
@ -109,7 +127,7 @@ must be a `forward traversal iterator`_. Therefore, we'll pass
|
||||
``boost::forward_traversal_tag`` in this position [#category]_.
|
||||
|
||||
.. [#category] ``iterator_facade`` also supports old-style category
|
||||
tags, so we could've passed ``std::forward_iterator_tag`` here;
|
||||
tags, so we could have passed ``std::forward_iterator_tag`` here;
|
||||
either way, the resulting iterator's ``iterator_category`` will
|
||||
end up being ``std::forward_iterator_tag``.
|
||||
|
||||
|
Reference in New Issue
Block a user