|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-08-15 22:08:57
From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>
> At Thursday 2002/08/15 13:15, you wrote:
> >No, there won't be any behavior because compilation will fail.
>
> that is surprising, IMO.
OK, but it's not "behavior" in the sense we usually use it.
> I know the standard doesn't say anything, but I find it offensive that
you
> will be able to write:
>
> someT = a[n];
>
> but NOT
>
> a[n] = someT
>
> Well, with the language lawyers around I guess I should say:
> that you can write without compilation error:
That's not what I'm going to correct you about. The standard *does* say
something!
It says that in a generic algorithm requiring nothing more of x than that
it is a random access iterator, you *can't* write:
x[n] = someT.
Fortunately, operator[] is in some sense superfluous for a random-access
iterator, since you can always do:
*(x + n) = someT
Anyway, be as offended as you like; I didn't make the rule.
-Dave
-----------------------------------------------------------
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