home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
- From: tmb@arolla.idiap.ch (Thomas M. Breuel)
- Newsgroups: comp.lang.c++
- Subject: Re: operator [][]
- Date: 12 Nov 92 11:56:39
- Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
- Perceptive)
- Lines: 29
- Message-ID: <TMB.92Nov12115639@arolla.idiap.ch>
- References: <BxFt8r.2Kt@cs.columbia.edu> <1992Nov9.095352.19114@fmrco.uucp>
- <1992Nov9.114516.29846@alf.uib.no>
- <1992Nov11.182016.13511@ucc.su.OZ.AU>
- Reply-To: tmb@idiap.ch
- NNTP-Posting-Host: arolla.idiap.ch
- In-reply-to: maxtal@extro.ucc.su.OZ.AU's message of Wed, 11 Nov 1992 18:20:16 GMT
-
- In article <1992Nov11.182016.13511@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
-
- It would be nice if [] could work like (), that is one could
- declared
-
- operator[](int,int,int){ ...}
-
- for example, that is, allow multiple arguments for [] just like ().
- This would allow multiple dimensioned matrices as well as providing
- a wealth of extra overloadable notations.
-
- It would of course break those programs for which
-
- a[2,3];
-
- actually meant a[3] using the comma operator, but there surely are not
- so many of them ..??
-
- Well, in principle that ambiguity is resolvable: you use the
- "operator[](int,int)" interpretation only if such an operator is
- actually defined. Of course, that would make parsing and compiling
- even messier than it is now (think about templates...).
-
- Altogether, we will probably just have to continue to live with what
- is there. I have been using "operator[]" less and less in my code
- (only for 1D collections) and have been relying on "operator()" or
- member functions ("foo.sub(x,y)") instead.
-
- Thomas.
-