non-inline template function within a class


It is always possible to declare an inline template function within a class.

Is it possible to have a non-inline template function within a class?

How do we call it?

For example:

in Header file
class TMyClass
template bool MyFunc(T a, T b) ;

extern TMyClass MyClass;

In Cpp file
TMyClass MyClass;
template bool MyClass::MyFunc(T a, T b)
// ... do stuff
return true;

In another Cpp, file
How do we call this member function?

MyClass.MyFunc(i,j); // does not work (compiler error)
MyClass.templateMyFunc(i,j); // does not work (compiler error)


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!