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

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