home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!swrinde!cs.utexas.edu!lgc.com!srinivas
- From: srinivas@lgc.com (Manapragada Srinivas)
- Newsgroups: comp.lang.c++
- Subject: Constructor arguments for template classes
- Message-ID: <1992Aug20.224111.2017@lgc.com>
- Date: 20 Aug 92 22:41:11 GMT
- Sender: usenet@lgc.com
- Organization: Landmark Graphics Corporation
- Lines: 37
- Nntp-Posting-Host: squirt.lgc.com
-
-
- Hi,
-
- I have a question about templates -
-
- Suppose I design a Vector template class as follows
-
- template <class T>
- class Vector
- {
- public:
- Vector( int size );
- // ... destructors, private members etc.
-
- }
-
- a. Does Vector< Vector<int> > make sense?
-
- b. If so how do I initialize it?
-
- g++ is not happy about
- Vector< Vector<int> > vec(10);
-
- nor does it accept
- Vector< Vector<int> > vec(10, 10);
-
- both the times it complains about too few arguments for the
- constructor.
-
-
- Any help on the above would be greatly appreciated.
-
- Thanks in advance,
-
- Srinivas
- --
- Yonder, beyond the event horizon!
-