RE: Re[4]: [Dev-C++] templates and inheritance
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@at...> - 2003-04-30 13:30:30
|
> -----Original Message-----
> From: Astar [mailto:As...@tu...]
> Sent: Wednesday, April 30, 2003 4:21 PM
> To: Ioannis Vranos; Dev-Cpp mail list
> Subject: Re[4]: [Dev-C++] templates and inheritance
>
>
> Hello Ioannis,
>
>
> IV> export template<class T>
> IV> class whatever
> IV> {
> IV> // ...
> IV> };
>
> may be i don't understand you...
> i understand that if i have two files (.h/.cpp) i must dublicate
> definition of template in .cpp file with word "extern". Am I right?
> or i must dublicate definition of template in every file where i use
> it?
You can place the definition in one .cpp file accompanied with the keyword
"export" and its *declaration* in every scope you use the class (usually
using a header file),
OR you can place the *definition* in every scope you use the class (e.g.
using a header file) without the keyword "export" of course.
The keyword export requires serious effort to be implemented, so it is not
supported by most compilers (and there is discussion inside the C++
committee for the upcoming C++0x standard, whether the keyword "export" to
become optional.).
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net
Anti-racism movement: http://www.positive-youthfoundation.org
Iraq Peace Pledge: http://www.peacepledge.org
|