home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!agate!matt
- From: matt@physics2.berkeley.edu (Matt Austern)
- Newsgroups: comp.lang.c++
- Subject: Re: Proposal: Subscripting with multiple arguments
- Date: 14 Sep 92 22:19:04
- Organization: Lawrence Berkeley Laboratory (Theoretical Physics Group)
- Lines: 28
- Message-ID: <MATT.92Sep14221904@physics2.berkeley.edu>
- References: <1992Sep14.182942.1986@athena.mit.edu>
- <MATT.92Sep14161955@physics.berkeley.edu>
- <1992Sep15.031111.15170@u.washington.edu>
- Reply-To: matt@physics.berkeley.edu
- NNTP-Posting-Host: physics2.berkeley.edu
- In-reply-to: rons@hardy.u.washington.edu's message of Tue, 15 Sep 1992 03:11:11 GMT
-
- In article <1992Sep15.031111.15170@u.washington.edu> rons@hardy.u.washington.edu (Ronald Schoenberg) writes:
-
- > M++ has four dimensional arrays that can be generalized to any number
- > of dimensions with minor changes in source code. It, however, overloads
- > operator() rather than operator[].
-
- Yep. The problem with doing this, though, is that the designer of the
- array class has to impose some arbitrary limit on the number of
- dimensions---whether two, or three, or four, it's still arbitrary. It
- would be nice to have an array class where this wasn't true.
-
- 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.
-
- This isn't really a practical problem: for several obvious reasons,
- high-dimensional arrays aren't very common. Still, arbitrary limits
- like that seem FORTRAN-ish and inelegant, and it would be nice if I
- could find a better way.
- --
- Matthew Austern Just keep yelling until you attract a
- (510) 644-2618 crowd, then a constituency, a movement, a
- austern@lbl.bitnet faction, an army! If you don't have any
- matt@physics.berkeley.edu solutions, become a part of the problem!
-