|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-08-23 13:32:06
From: "Andrew Koenig" <ark_at_[hidden]>
> iter[integer]
> iter + integer (and integer + iter)
> iter - iter
>
> Either of the first two operations can substitute for the other,
> so the real question is whether the second is much more common than
> the first. I suspect it isn't.
I don't think that's the real question at all.
The problem is that the return type of operator[] can't be relied on to be
a reference, and in particular you can't do
p[n] = x;
with a generic random-access iterator.
*(p + n) = x;
always works (for sufficiently correct values of n and x).
-----------------------------------------------------------
David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk