home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12674 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1017 b   |  49 lines

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!swrinde!cs.utexas.edu!lgc.com!srinivas
  2. From: srinivas@lgc.com (Manapragada Srinivas)
  3. Newsgroups: comp.lang.c++
  4. Subject: Constructor arguments for template classes
  5. Message-ID: <1992Aug20.224111.2017@lgc.com>
  6. Date: 20 Aug 92 22:41:11 GMT
  7. Sender: usenet@lgc.com
  8. Organization: Landmark Graphics Corporation
  9. Lines: 37
  10. Nntp-Posting-Host: squirt.lgc.com
  11.  
  12.  
  13. Hi,
  14.  
  15.     I  have a question about templates -
  16.  
  17.     Suppose I design a Vector template class as follows
  18.  
  19.     template <class T>
  20.     class Vector
  21.     {
  22.     public:
  23.         Vector( int size );
  24.         // ... destructors, private members etc.
  25.  
  26.     }
  27.  
  28.     a. Does Vector< Vector<int> > make sense?
  29.  
  30.     b. If so how do I initialize it?
  31.  
  32.         g++ is not happy about
  33.             Vector< Vector<int> > vec(10);
  34.  
  35.         nor does it accept
  36.             Vector< Vector<int> > vec(10, 10);
  37.  
  38.       both the times it complains about too few arguments for the
  39.       constructor.
  40.  
  41.  
  42.     Any help on the above would be greatly appreciated.
  43.  
  44. Thanks in advance,
  45.  
  46. Srinivas
  47. --
  48. Yonder, beyond the event horizon!
  49.