Boost logo

Boost :

Subject: [boost] [iterator] Combining traversal_tags with iterator_tags
From: Ronald Garcia (rxg_at_[hidden])
Date: 2012-01-07 15:28:37


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:

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?


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:


So I think the argument order is flipped.

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