Boost logo

Boost :

Subject: Re: [boost] [iterator] Combining traversal_tags with iterator_tags
From: Ronald Garcia (rxg_at_[hidden])
Date: 2012-01-08 23:49:58


Hello Thomas,

Thank you for the offered patch. Unfortunately this is not quite right because it would result in const_iterators being declared as output iterators as well.

Cheers,
Ron

On Jan 8, 2012, at 5:34 PM, Thomas Klimpel wrote:

> Ronald Garcia wrote:
>> 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.
>> [snip]
>> 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.
>
> This is a very good idea. The advantage of this "idea" over my ideas how to fix the problem is that you neither need to modify Boost.Iterator, nor to "lie" to the compiler. However, I would just declare the required iterator_tag class locally, so that you don't depend on implementation details of Boost.Iterator:
>
> struct random_access_traversal_input_output_iterator_tag
> : boost::random_access_traversal_tag, std::input_iterator_tag
> {
> operator std::output_iterator_tag() const { return std::output_iterator_tag(); }
> };
>
> The attached patch for multi_array/iterator.hpp does exactly that. You should be able to apply it directly, without any need to wait for changes to Boost.Iterator. Independently, you can still pursue your feature request for Boost.Iterator (if you want).
>
> Regards,
> Thomas<multi_array_iterator.patch>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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