S
Simon G Best
Daniel said:Simon G Best said:Not if the interface also has operator().
And once again, the whole proxy interface becomes something added to
placate those who like to use [][] and legacy code.
Is there any class that supports the [][] interface that is as flexible
as one that supports the (,) interface, but doesn't simply convert the
former to the latter?
So what if [][] converts to (,)? [][] is part of the interface. How
it's implemented internally should be unimportant to what the interface
is. So, really, the issue of whether or not [][] internally converts to
(,) should be irrelevant to the issue of whether or not it's appropriate
to provide [][] in the interface.
Anyway, we could always implement [][] more directly, and then define
(,) in terms of [][]. Would that mean we should not use (,)? Of course
not!
If we're going to have row() and col() with proxies (and there are good
uses for them), then adding [][] is very cheap indeed (the first [] just
inlines to row(), which would provide an operator[] anyway).
Simon