Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-11-24 16:13:01


On Fri, 24 Nov 2000, David Abrahams wrote:
> > Currently we are just trying to add a "const" qualification to the inner
> > iterator (iterator_traits<T**>::value_type) to get the inner const
> > iterator (const iterator_traits<T**>::value_type). I think this is wrong
> > for a couple reasons. First, I think adding the const there gives you a
> > const iterator instead of an immutable iterator (the const needs to apply
> > to the thing pointed at).
>
> I think John has been trying to get us to see that for months.

Right, though I think John's solution was adding const as above, which
still wasn't quite right. (John, please correct me if I'm wrong in saying
that!)

> I think there's an interesting parallel between what we're doing with
> iterator_adaptors and what a container does. It would be instructive to try
> to generalize the layers between the value_type and the iterator, and
> describe the const/non-const relationships...someday. I'm just grasping at a
> vague idea here, but wouldn't one want:
>
> deque<const T>::iterator == deque<T>::const_iterator == (const
> deque<T>)::iterator
>
> in some sense?

Yeah... this is where I start to have doubts about how const works
in C++. It has weird implications in this area.

> I'm far enough away from the inner workings now that I find the above highly
> confusing. Especailly incantations like: "indirect_traits<IndirectIterator,
> IndirectTraits, Traits>". If you'd like to add some commentary, I'm sure it
> would help other readers/maintainers. Otherwise, I am prepared to trust that
> you and John have the situation well in-hand.

I'll add some comments, and do some renaming...

Cheers,

Jeremy

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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