Boost logo

Boost :

From: Dirk Gerrits (dirkg_at_[hidden])
Date: 2002-06-18 04:11:05

Hi Jeremy,

> dirkg> On the default
> dirkg> of Value is said to be: std::iterator_traits<
> dirkg> std::iterator_traits<BaseIterator>::value_type >::value_type
> dirkg> which seems a bit 'overdone'. I think it should be
> dirkg> std::iterator_traits<BaseIterator>::value_type, correct?
> I think the original is correct. The idea of an indirect_iterator is that
> you have a base iterator whose value types are also iterators, and that
> the indirect_iterator does a double dereference inside operator*. Thus the
> value type of indirect_iterator is the value type of the value type of the
> base iterator.

Oh of course. How stupid of me. Please forgive me. :)

> dirkg> Also the docs say that you can't use the default template parameters for
> dirkg> iterator_adaptor when there is no partial template specialization
> dirkg> support and the base iterator is a raw pointer. I was wondering what the
> dirkg> rationale is for not providing a workaround for this. Is it simply not
> dirkg> possible, or are there other reasons?
> The reason was that we believed it not possible, which I still think is
> the case. Though you never know what new tricks people will come up with :)

Couldn't you do a compile-time 'select' on 'is_pointer' to redirect
pointer types to 'boost::detail::pointer_iterator_traits' and other
iterators to 'std::iterator_traits'? I haven't tried it, but in my mind
it seems plausible. Your thoughts?

Dirk Gerrits

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