Mail Archives: djgpp/1998/09/02/03:45:24
From: | bitland AT aol DOT com (Bitland)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | who is template-experienced ?
|
Lines: | 43
|
Message-ID: | <1998090207405800.DAA29531@ladder01.news.aol.com>
|
NNTP-Posting-Host: | ladder01.news.aol.com
|
Date: | 2 Sep 1998 07:40:58 GMT
|
Organization: | AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi !
Perhaps there are FAQ's for, but how to search ...
I have three problems using templates:
1.) Defining a template of a class, I have to define all of the functions in
the header,
or the linker will not find them:
Example:
template <class TYP>
class X
{
void myfunc(TYP* p);
};
template <class TYP> void X::myfunc(TYP* p) { dosomething(); }
How can I realize this, I want to keep the functions separated in a
cc-file ?
2.) how have I to write defining a templated class as a friend of another one
?
class Y
{
template <class xtyp> friend class X<xtyp>; // ?!?!?
}
3.) how to declare a templated class in another headerfile ?
The compiler will always find two different types of definitions !
If I can't do this, I got problems in my header-structure, because things
could need each other.
template <class TYP> class X<TYP>; // ?!?!?
Hope to find anyone experienced who can answer me those questions.
Please answer to bitland AT aol DOT com
Much thanks
Andreas Kluge
- Raw text -