Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-08-23 15:39:45


Andrew Koenig <ark_at_[hidden]> writes:

| David> I don't think that's the real question at all.
|
| David> The problem is that the return type of operator[] can't be relied on to be
| David> a reference, and in particular you can't do
|
| David> p[n] = x;
|
| David> with a generic random-access iterator.
|
| David> *(p + n) = x;
|
| David> always works (for sufficiently correct values of n and x).
|
| Interesting -- I wonder why I never noticed that?
|
| One would think that p[n] should be equivalent to *(p+n) -- in particular
| it should be required to have the same type.

The random access iterator requirements table 76 says that p[n] as the
"operational semantics" "*(p + n)".

-- Gaby


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