templates

Pascal Francq pfrancq at ulb.ac.be
Wed Nov 28 16:57:19 GMT 2001


On Wednesday 28 November 2001 17:09, you wrote:
> > Are this function implemented in a file that is include (via #include) in
> > the source files where you use it, because gcc doesn't handle, actually I
> > hope, the external templates.
>
> I'm not sure to understand your question because you said "implemented".
> I've a template definition in tlist.h names TList
> ( template <class T> class TList{} )
> and an implementation of the class in a tlist.cpp, the file tlist.h is
> include (via #include) in my main.cpp.
> I'ts that correct?
> S at lu2
> Israel
>
> -

No, you must also include the cpp file somewhere, because the compiler need 
to know the implementation while compiling.
Example:

// t.h
#ifndef tH
#define tH

template<class T> void Func(T* ptr);

#include "t.cpp"

#endif


// t.cpp
template<classT> void Func(T* ptr)
{
	T->DoSomething();
}

-- 


Ir Pascal Francq
Researcher
Université Libre de Bruxelles
CAD/CAM Department
Avenue F.D. Roosevelt, 50
CP 165/14
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 47 24
ICQ: 91206668

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list