home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!olivea!spool.mu.edu!wupost!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.c++
- Subject: Re: Proposal: Subscripting with multiple arguments
- Message-ID: <1953s5INNovn@early-bird.think.com>
- Date: 15 Sep 92 16:43:49 GMT
- References: <MATT.92Sep14161955@physics.berkeley.edu> <1992Sep15.031111.15170@u.washington.edu> <MATT.92Sep14221904@physics2.berkeley.edu>
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 22
- NNTP-Posting-Host: telecaster.think.com
-
- In article <MATT.92Sep14221904@physics2.berkeley.edu> matt@physics.berkeley.edu writes:
- >Note, by the way, that if you're overloading operator(), there's no
- >way around this, since the signature of that function is different
- >depending on the dimensionality of the array. That is,
- >two-dimensional arrays work by overloading operator()(int,int), but
- >three-dimensional arrays work by overloading operator()(int,int,int).
- >You can't overload an infinite number of functions, so there has to be
- >some maximium on the dimensionality that you support.
-
- Can you overload operator()(int,...)? I looked in the ARM quickly and
- couldn't see a prohibition of this in the section about overloading
- operator().
-
- Of course, this type of function is not type-safe. The implementation of
- it would probably have to assume that the number of arguments is at least
- the number of dimensions of the array being indexed.
-
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-