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

  1. Path: sparky!uunet!decwrl!olivea!bu.edu!att!att!allegra!alice!bs
  2. From: bs@alice.att.com (Bjarne Stroustrup)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: backwards references in templates
  5. Message-ID: <23643@alice.att.com>
  6. Date: 8 Sep 92 12:32:47 GMT
  7. References: <TMB.92Sep7163720@arolla.idiap.ch>
  8. Distribution: comp
  9. Organization: AT&T Bell Laboratories, Murray Hill NJ
  10. Lines: 18
  11.  
  12.  
  13.  
  14. tmb@arolla.idiap.ch (Thomas M. Breuel @ IDIAP) writes
  15.  
  16.  > The following definition of Foo appears to be illegal (GNU C++ doesn't
  17.  > accept it, and the ARM doesn't seem to sanction it):
  18.  > 
  19.  >     template <class K,K x>
  20.  >     struct Foo {
  21.  >         K y;
  22.  >         Foo() { y = x; }
  23.  >     };
  24.  >     
  25.  > This restriction on the uses of template arguments (as in "Foo") is a
  26.  > serious problem, since such dependencies occur frequently.
  27.  
  28. I see nothing wrong with this example and see nothing in the ARM that
  29. prohibits it.
  30.