Boost logo

Boost :

Subject: Re: [boost] [gil] how does dereference_iterator_adaptor defines it's iterator category?
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-06-01 16:43:32

Hi there,

> dereference_iterator_adaptor uses iterator_adapter with a traversal/category
> type of boost::use_default. The way use_default behaves is to discover the
> category/traversal type of the iterator it's adapting
> (bit_aligned_pixel_iterator<...> in this case), then convert that into a
> traversal type. In this case, bit_aligned_pixel_iterator has a category of
> std::random_access_iterator_tag, which gets converted back into
> boost::random_access_traversal_tag. <snip>

I could not figure out how this use_default parameter behaves. With
your explanation I think the conversion is done inside
iterator_adaptor_base class when putting together a iterator_facade
type. I think the compile time function ia_dflt_help is doing it.
Please correct me when I'm wrong, but this function just compares
against use_default and uses either iterator_traversal<Base> in case
of use_default or does nothing. Now iterator_traversal<Base> is doing
exactly what we are doing it's invoking std::iterator_traits<Iterator>
internally. Though, I still don't quite understand where the
boost::random_access_traversal_tag is coming from?

But at the end of the day I understand your proposed fix and it works.

Thanks a lot for your help,

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