home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13662 < prev    next >
Encoding:
Internet Message Format  |  1992-09-14  |  2.1 KB

  1. Path: sparky!uunet!spool.mu.edu!agate!agate!matt
  2. From: matt@physics2.berkeley.edu (Matt Austern)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Proposal: Subscripting with multiple arguments
  5. Date: 14 Sep 92 22:19:04
  6. Organization: Lawrence Berkeley Laboratory (Theoretical Physics Group)
  7. Lines: 28
  8. Message-ID: <MATT.92Sep14221904@physics2.berkeley.edu>
  9. References: <1992Sep14.182942.1986@athena.mit.edu>
  10.     <MATT.92Sep14161955@physics.berkeley.edu>
  11.     <1992Sep15.031111.15170@u.washington.edu>
  12. Reply-To: matt@physics.berkeley.edu
  13. NNTP-Posting-Host: physics2.berkeley.edu
  14. In-reply-to: rons@hardy.u.washington.edu's message of Tue, 15 Sep 1992 03:11:11 GMT
  15.  
  16. In article <1992Sep15.031111.15170@u.washington.edu> rons@hardy.u.washington.edu (Ronald Schoenberg) writes:
  17.  
  18. > M++ has four dimensional arrays that can be generalized to any number
  19. > of dimensions with minor changes in source code.  It, however, overloads
  20. > operator() rather than operator[].  
  21.  
  22. Yep.  The problem with doing this, though, is that the designer of the
  23. array class has to impose some arbitrary limit on the number of
  24. dimensions---whether two, or three, or four, it's still arbitrary.  It
  25. would be nice to have an array class where this wasn't true.
  26.  
  27. Note, by the way, that if you're overloading operator(), there's no
  28. way around this, since the signature of that function is different
  29. depending on the dimensionality of the array.  That is,
  30. two-dimensional arrays work by overloading operator()(int,int), but
  31. three-dimensional arrays work by overloading operator()(int,int,int).
  32. You can't overload an infinite number of functions, so there has to be
  33. some maximium on the dimensionality that you support.
  34.  
  35. This isn't really a practical problem: for several obvious reasons,
  36. high-dimensional arrays aren't very common.  Still, arbitrary limits
  37. like that seem FORTRAN-ish and inelegant, and it would be nice if I
  38. could find a better way.
  39. --
  40. Matthew Austern                   Just keep yelling until you attract a
  41. (510) 644-2618                    crowd, then a constituency, a movement, a
  42. austern@lbl.bitnet                faction, an army!  If you don't have any
  43. matt@physics.berkeley.edu         solutions, become a part of the problem!
  44.