c++ - Templated class specialization where template argument is a template -


i wondering if similar possible. basically, have templated class takes objects of templated classes. specialize (or member function)for specific templated class, 'generic' form of class.

template<typename t, typename s> class somerandomclass {     //put here };  template<typename t> class mytemplateclass {     void dosomething(t & t) {        //...something     } };  template<> void mytemplateclass< somerandomclass<???> >::dosomething(somerandomclass<???> & t) {     //something specialized happens here } 

replacing question marks appropriate types (double, etc) works, remain generic. don't know put there, types wouldn't have been defined. i've looked around, , learned template template parameters, , tried various combinations no avail. help!

it's possible specialize class this

template <> template <typename t,typename s> class mytemplateclass <somerandomclass<t,s> > {     void dosomething(somerandomclass<t,s>& t) { /* */ } }; 

it's not possible specialize member method, because specialization on class whole, , have define new class. can, however, do

template <> template <typename t,typename s> class mytemplateclass <somerandomclass<t,s> > {     void dosomething(somerandomclass<t,s>& t); };  template <> template <typename t,typename s> void mytemplateclass<somerandomclass<t,s> >::dosomething(somerandomclass<t,s>& t) {     // } 

to split declaration , definition.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -