One of the old issues that's come up a few times is whether
"operator" should have the same argument syntax as "operator()"
or regular function call syntax. Currently,
is a two-argument function call, while
is an invocation of the comma operator which ignores a
and is equivalent to
As a result, "operator" can only take one argument. This
prohibits the creation of multidimensional array classes using
standard bracket syntax.
The justification for this is protection of legacy code which
might conceivably use the comma operator within square brackets.
But now we have Google Code Search, and can easily look for
such usages. A search key to use is:
This isn't perfect, but comes as close as we can get with regular expressions.
(The main problem is throwing out comments and quotes; there are about 12,000
occurences of commas inside square brackets inside quotes or comments.)
This gets us about 100 hits.
They're all in multline comments, Microsoft "@deftypefn" statements,
char constants, template type arguments or embedded assembler.
Try the search yourself. Commas inside subscript expressions just
aren't being used in the visible universe of C++ code.
At last, we have the tools to dispose of this question.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:firstname.lastname@example.org ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.yqcomputer.com/