S
skscpp
I have a question regarding "optional" inheritance in regards to template.
This is not compiled code.
template<typename T, typename P1 = Invalid<1>, typename P2 = Invalid<2>,
typename P3 = Invalid<3> >
class Mgr : public T,
public virtual Mgmt<P1>,
public virtual Mgmt<P2>,
public virtual Mgmt<P3>
{
public:
// .....
};
Now if the user sends the following:
class Mgr1;
class My1;
class My2;
Mgr<Mgr1, My1> MyMgr1; // I want the Mgr template to inherit from Mgr1 and
Mgmt<My1>, not Mgmt<Invalid<2>> or
Mgmt<Invalid<3>>
Mgr<Mgr1, My1, My2> MyMgr2; // I want the Mgr template to inherit from Mgr1,
Mgmt<My1>, and Mgmt<My2>, not Mgmt<Invalid<3> >
Is this possible to that?
Thanks.
This is not compiled code.
template<typename T, typename P1 = Invalid<1>, typename P2 = Invalid<2>,
typename P3 = Invalid<3> >
class Mgr : public T,
public virtual Mgmt<P1>,
public virtual Mgmt<P2>,
public virtual Mgmt<P3>
{
public:
// .....
};
Now if the user sends the following:
class Mgr1;
class My1;
class My2;
Mgr<Mgr1, My1> MyMgr1; // I want the Mgr template to inherit from Mgr1 and
Mgmt<My1>, not Mgmt<Invalid<2>> or
Mgmt<Invalid<3>>
Mgr<Mgr1, My1, My2> MyMgr2; // I want the Mgr template to inherit from Mgr1,
Mgmt<My1>, and Mgmt<My2>, not Mgmt<Invalid<3> >
Is this possible to that?
Thanks.