c++ - Specializing only a part of a template function's implementation -


i'm wondering if anyhow possible partially specialize templated method behaviour in case 1 of template parameter it's of type.

template<class t> void foo(t& parameter) {     /* generic - types - stuff */      if(t int) // pseudo-code, typeinfo? boost?     {         /* specific int processing might not compile other types */     }      /* again common stuff */ } 

any suggestion welcome. thanks

if want specialize part of function have factor out part of function specialized implementations:

template<class t> void bar(t &t) {}  void bar(int &i) {     /* specific int processing might not compile other types */ }   template<class t> void foo(t &t) {     /* generic - types - stuff */      bar(t);      /* again common stuff */ } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -