I have just learn a few pages about templates and have the following problem.
A.h
struct A
{
template<class T> T func();
};
A.cpp
template<class T>
T func()
{
//do something
}
template<> int A::func<int>();
template<> char A::func<char>();
Now if I have this struct
template<class C>
struct B
{
template<typename T>
T func();
};
Will I have to write out all cases when func
is to be used with what specific class C
?
e.g
template<classX> int func<int>();
template<classX> char func<char>();
template<classY> int func<int>();
....