Boost logo

Boost :

Subject: Re: [boost] [iterator] Combining traversal_tags with iterator_tags
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-01-07 16:56:19

on Sat Jan 07 2012, Ronald Garcia <> wrote:

> Hi,
> In MultiArray I would like use iterator_facade to create an iterator
> that can satisfy random_access_traversal, input_iterator_tag, and
> output_iterator_tag. I see that in the file
> boost/iterator/detail/facade_iterator_category.hpp, at line 138 there is a class in the boost::detail namespace declared
> template <class Category, class Traversal>
> struct iterator_category_with_traversal
> So it looks like passing:
> boost::detail::iterator_category_with_traversal<boost::detail::input_output_iterator_tag,boost::random_traversal_tag>
> as the CategoryOrTraversal would be what I want. However, two
> components above are in the detail namespace, so I am not sure if they
> are meant to be used by other libraries. Is this a safe operation?

Using things in detail namespaces is never really "safe" unless you own
the surrounding namespace.

> Side Notes:
> In my searches, I found a few buggy bits in the docs and code comments:
> - In boost/iterator/detail/facade_iterator_category.hpp, line 76, there's a comment:
> // If writability has been disabled per the above metafunction, the
> // result will not be convertible to output_iterator_tag.
> This comment corresponds to behavior that was removed in changeset:
> Now the result will never be convertible to output_iterator_tag.
> - In the documentation for iterator_facade, there's a bit of a booboo where the function is first written:
> iterator-category(CategoryOrTraversal, value_type, reference)
> Then defined as:
> iterator-category(C,R,V)
> So I think the argument order is flipped.

Please open Trac tickets for any of these that don't already have them.


Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at