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
Post a Comment