i have several classes same template arguments. use oftenusedtype
template. typedef
r
have more convenient notation:
template <class t, int a, int b> class obj{ typedef oftenusedtype<t, a, b> r; }
unfortunately, have in classes use oftenusedtype
, since depends on template parameters.
the way make bit more convenient typedef
in class , inherit classes use it:
template <class t, int a, int b> class objtypedef{ typedef oftenusedtype<t, a, b> r; } template <class t, int a, int b> class obj : public objtypedef<t, a, b>{ }
but still have inherit typedef class classes use type...
is there more convenient, good-style way it?
if c++11 acceptable, use alias template, has more natural syntax:
template <class t, int a, int b> using r = oftenusedtype<t,a,b>;
Comments
Post a Comment