home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / atari / st / 11560 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.3 KB  |  65 lines

  1. Path: sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!uqcspe!cs.uq.oz.au!warwick
  2. From: warwick@cs.uq.oz.au (Warwick Allison)
  3. Newsgroups: comp.sys.atari.st
  4. Subject: Re: problems with gcc/g++
  5. Message-ID: <9485@uqcspe.cs.uq.oz.au>
  6. Date: 22 Jul 92 03:59:59 GMT
  7. References: <bnell.711691021@cadillac>
  8. Sender: news@cs.uq.oz.au
  9. Reply-To: warwick@cs.uq.oz.au
  10. Lines: 53
  11.  
  12. bnell@siemens.com. (Bill Nell) writes:
  13.  
  14. >the result file comes out to be like 95 bytes.
  15.  
  16. >only difference in this file is that it is a class that uses templates.
  17. >So, can anyone tell me what's wrong???
  18.  
  19. What's wroing is that Bill, like me, didn't read the C++ Reference Manual
  20. very carefully.
  21.  
  22. Templates are not "compiled".  That doesn't make any sense.  Templates can
  23. only be compiled once they have been instanciated.  Here is the usual usage:
  24.  
  25.  
  26. main.cc:
  27.  
  28.    #include <SetTempl.cc>
  29.  
  30.    main()
  31.    {
  32.      Set<int> MyIntSet;
  33.      ...
  34.    }
  35.  
  36.  
  37. SetTempl.cc:
  38.  
  39.    #include <SetTempl.h>
  40.  
  41.    template <class T>
  42.    Set::Set()
  43.    {
  44.      ...
  45.    }
  46.  
  47.  
  48. SetTempl.h:
  49.  
  50.    template <class T> class Set {
  51.     ...
  52.    };
  53.  
  54.  
  55.  
  56.  
  57. For more details, RTFM, or check in to comp.lang.c++
  58. --
  59. Warwick
  60. --
  61.   _-_|\      warwick@cs.uq.oz.au            /Disclaimer:
  62.  /     * <-- Computer Science Department,  /  
  63.  \_.-._/     University of Queensland,    /      void (if removed)
  64.       v      Brisbane, Australia.        /  
  65.