Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-02-12 07:08:14


Angus Leeming <angus.leeming_at_[hidden]> writes:

> David Abrahams wrote:
>>> In the section "Template Arguments for iterator_facade" is the
>>> subsection "CategoryOrTraversal". I suspect that should be
>>> "CategoryOfTraversal" (s/Or/Of/).
>>>
>>> The iterator_adapter docs spell it "CategoryOrTraversal" too.
>>
>> No, the spelling is as intended.
>>
>> It's either an iterator category tag (such as
>> std::random_access_iterator_tag) or an iterator traversal tag (such
>> as boost::random_access_traversal_tag).
>
> Thanks for the explanation.
>
> Would it not be worthwhile putting something like this in the
> documentation? Perhaps in iterator_facade.html#tutorial-example where
> the CategoryOrTraversal template parameter is explained and where the
> explanation mentions 'iterator tranversal concepts' only.
> Indeed clicking on the link of that name takes me to a point where
> the tables again mention only traversal.
>

Huh?

  CategoryOrTraversal

  Now we have to determine which iterator traversal concept our
  node_iterator is going to model. Singly-linked lists only have
  forward links, so our iterator can't can't be a bidirectional
  traversal iterator. Our iterator should be able to make multiple
  passes over the same linked list (unlike, say, an istream_iterator
  which consumes the stream it traverses), so it must be a forward
  traversal iterator. Therefore, we'll pass
  boost::forward_traversal_tag in this position [1].

  [1] iterator_facade also supports old-style category 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.

What am I missing?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk