Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2000-12-21 08:57:43


> From: John E. Potter [mailto:jpotter_at_[hidden]]
>
> I see typedef T const& reference. The required typedef is reference.
> I understand your concern though.

>
> > [2] I think the "pointer" type should be "const value_type *".
>
> It really makes no difference. Pointer is the type returned by
> operator->. That operator returns &operator*(). But, operator*
> returns an rvalue and address of may not be used on an rvalue.

Actually, I don't see "pointer" and "reference" actually *required*
anywhere. They're provided by all the Standard iterators, but in 24.3.1/1 I
only see the other three types (difference, value, and category) as
required. I wonder if this was the intention of the Standard or an
accidental omission?

> > [3] This adaptor does not return a reference type when dereferenced;
thus,
> > it should only claim to be an input iterator (it can still support [],
+=,
> > etc., though) (flame-resistent hat on now...)
>
> It can't even claim that. If you check the input iterator requirements
> closely, I think you will find that it can only be an input iterator
> when the value type is a built-in, and I am not even sure of that.

I don't think so. Note 24.1.1/3: "...Value type T is not required to be an
Assignable type..." I don't see anything that requires them to be built-in.

However, there may be a problem with operator->, as you pointed out. In
this case, (*i).m is well-defined, but i->m appears to be unimplementable
unless the iterator is buffered (see 24.1/1). OTOH, maybe we can force it
to work through some proxy pointer return type. Was this the intention of
the Standard (I'm thinking we could get away with disallowing "i->m" for
input iterators)?

        -Steve


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