Howdy, Stranger!

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

Categories

non-inline template function within a class

SVC1SVC1 Member Posts: 5
Hi,

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
{
public:
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)

Thanks,
S

Sign In or Register to comment.