c++ - Partial specialization: use the primary template members -


consider

enum my_enum {     x1, x2 };  template<class t, my_enum x> class {     void f1();     void f2(); };  template<class t> class a<t,x1> {     void g(); } 

i want use member functions f1() , f2() of primary template in partially specialized template. should ?

one solution not partial specialization , then:

template<class t> class aa<t> : public a<t,x1> {     void g(); } 

but has drawback when i'm instatiating a<t,x>s of sorts generic programming, a<t,x1> no longer of type aa<t> , hence cannot apply a<t,x1>.g()

any idea ?

how creating base class class defines methods?

template <class t, my_enum x> class a_base {     void f1();     void f2(); };  template<class t, my_enum x> class : public a_base<t, x> { };  template<class t> class a<t,x1> : public a_base<t, x1> {     void g(); }; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -