Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-05-25 18:08:06


From: joel de guzman <joel_at_[hidden]>
> From: "Douglas Gregor" :
>
> > The bracket notation unfortunately can't be used for everything, because
> > digit[0, 2] == digit[2]
>
> Please elaborate...

With this file:

1 struct X {
2 X& operator[](int,int) { return *this; }
3 X& operator[](int) { return *this; }
4 };
5
6 int main() {
7 X x;
8 X y = x[0,1];
9 return 0;
10 }

EDG gives these warnings:

    "temp.cpp", line 2: error: too many parameters for this operator function
       X& operator[](int,int) { return *this; }
        ^

    "temp.cpp", line 8: warning: expression has no effect
       X y = x[0,1];

So it goes.


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