C++ template class's template specialization -
i trying specialize template method 'he' couldn't compile. how right?
#pragma once template<typename a, typename b> class template_test { public: template_test(); ~template_test(); template<typename c> void he(c gg); }; template<typename a, typename b> template<typename c> void template_test<a, b>::he( c gg ) { } template<typename a, typename b> template<> void template_test<a, b>::he( int gg ) { }
error c1506: unrecoverable block scoping error
unable match function definition existing declaration
you have specialize class also. cannot specialize member:
template<> template<> void template_test<int, int>::he<int>( int gg ) { }
however, instead, add overload:
void he(int gg){}
Comments
Post a Comment