tempate function into a non-templated class?
I would like to add a "templated function" into a non-templated function like this :
class A
{
template <class T>
void Test<T>();
}
template <class T>
A::Test<T>();
But it tell me that I have an error in开发者_JAVA技巧 the .h file ! Is there a problem with this declaration ?
Remarks : my class MUST not be templated !
Thanks
You can define a member function template as follows:
class A
{
template <typename T>
void Test()
{
...
};
};
精彩评论