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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -