Consider the following class template:
template <class T>
class MyClass
{
void MyFunc();
};
template <class T>
void MyClass<T>::MyFunc()
{
//...implementation goes here
}
I need to add another function template MyFunc2
which accepts a template argument T2
i.e.,
template <class T>
class MyClass
{
void MyFunc();
template <class T2>
static void MyFunc2(T2* data);
};
template <class T>
void MyClass<T>::MyFunc()
{
//...implementation goes here
}
template <class T, class T2>
void MyClass<T>::MyFunc2(T2* pData) // error here
{
//...implementation goes here
}
I am using VS 2008 compiler. I am getting the error:
error C2244: unable to match function definition to an existing declaration
What should the function's definition and declaration look like in this case?