When I use template partial specialization on a class with one template argument, I can specialize a method like this:
#include
template<
You cannot partially specialise functions – this includes member functions. You can only partially specialise the whole class:
template< typename T, std::size_t Dim >
class Test
{
public:
int foo()
{
return 0;
}
};
template< typename T >
class test< T, 1 >
{
public:
int foo()
{
return 1;
}
};
(I’ve defined the functions inline here; that of course isn’t necessary.)