Article View: alt.linux
Article #1087Re: Templates
From: Andrew Eiler
Date: Fri, 16 Apr 1999 00:00
Date: Fri, 16 Apr 1999 00:00
53 lines
2662 bytes
2662 bytes
Or include the cc file at the bottom header file. The only issue you run into would be a circular refrence, so you need to use some #defines to avoid that. eg... --- template.h --- #idndef TEMPLATE.H #define TEMPLATE.H //class def #include "template.cc" #endif ---eof--- ---template.cc--- #idndef TEMPLATE.CC #define TEMPLATE.CC //#include <...> //class def #endif --eof--- -andrew Pascal Proulx wrote: > Martijn, > read the info files provided with gcc. You are right: template code must > reside in a header file. > > >All functions in template classes must be inline. > I do not agree! > > Pascal > > Martijn Lievaart wrote: > > > Alexander Dymerets wrote in message <370C598E.C8C64F66@te.net.ua>... > > >Hi! > > >> I'm trying to design template classes in C++ (under Linux and Solaris) > > using > > >> the gcc compiler, but I'm running into trouble. It seems that the > > template > > >> functions must be written > > >> within the header (.h) file. Whenever they are written in the .cpp file > > I > > >> get errors about them not being there. > > > > > >All functions in template classes must be inline. > > > > Apart from some bugs in some compilers, this is simply not true. It is the > > most portable though. > > > > Martijn > > -- > > My reply-to address is intentionally set to /dev/null > > reply to mlievaart at orion in nl
Technical Details
Message-ID:
<37173C8E.3E223388@lehigh.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<ShVO2.260$G4.285045@news.abs.net> <370C598E.C8C64F66@te.net.ua> <7ei7vb$nad@news3.euro.net> <3714F74F.49173BD0@cdott.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5392,eaa6e2f181a1fe60 X-Google-Attributes: gidf5392,public X-Google-Thread: 10c696,eaa6e2f181a1fe60 X-Google-Attributes: gid10c696,public X-Google-Thread: f8c9b,eaa6e2f181a1fe60 X-Google-Attributes: gidf8c9b,public X-Google-Thread: faa64,eaa6e2f181a1fe60 X-Google-Attributes: gidfaa64,public X-Google-Thread: 10ba33,eaa6e2f181a1fe60 X-Google-Attributes: gid10ba33,public X-Google-Thread: fc89c,eaa6e2f181a1fe60 X-Google-Attributes: gidfc89c,public X-Google-Thread: 100c5f,eaa6e2f181a1fe60 X-Google-Attributes: gid100c5f,public X-Google-Thread: 109fba,eaa6e2f181a1fe60 X-Google-Attributes: gid109fba,public From: Andrew Eiler <aee2@lehigh.edu> Subject: Re: Templates Date: 1999/04/16 Message-ID: <37173C8E.3E223388@lehigh.edu> X-Deja-AN: 467220099 Content-Transfer-Encoding: 7bit References: <ShVO2.260$G4.285045@news.abs.net> <370C598E.C8C64F66@te.net.ua> <7ei7vb$nad@news3.euro.net> <3714F74F.49173BD0@cdott.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: alt.linux,alt.os.linux,comp.lang.c++,comp.os.linux.development.apps,comp.os.linux.development.system,comp.unix.programmer,comp.unix.questions,gnu.g++.help,gnu.gcc.help