C++ templates

Richard Moore rich at ipso-facto.freeserve.co.uk
Thu Nov 16 17:32:21 GMT 2000



Florian Wiesner wrote:
> 
> Hi,
> 
> is there a possibility to automate C++ template handling? I'm heavily
> confused
> by the C++ template syntax and would really be happy if I could let
> KDevelop
> do the work.
> My Problem is that I'd like to implement a class-contructor, that takes
> the
> generic types of my template as argument. When I'm defining the method
> within
> the class declaration, everything works fine, but after spliting the
> class code
> apart, into .cpp and .hpp the compiler nervs me, that the constructor's
> arguments
> are not enough defined... Could anyone help me?

You can't put templates in the .cpp - they must be in the header
file. If you have a method that is too big to write like this:

class Foo
{
	void bar() { /* My implementation */ };
}

then you should write it like this:

class Foo
{
	void bar();
}

inline void Foo::bar()
{
	/* My implementation */
}

but however you do it, the implementation MUST be in the header
file.

Rich.

> 
> Florian Wiesner
> 
> ------------------------------------------------------------------------------
> |Florian
> Wiesner                                                             |
> |student of computer science @ Technische Universität München,
> Munich(Germany)
> |wiesner at informatik.tu-muenchen.de
> |
> ------------------------------------------------------------------------------
> 
> -
> to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
> unsubscribe »your-email-address«

-- 
     Richard Moore		rich at ipso-facto.freeserve.co.uk
http://www.macromedia.com/	rjmoore at macromedia.com
http://developer.kde.org/	rich at kde.org

-
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