So, I've got a diamond hierarchy.
class Base {
// ...
}
class Derived_A : public Base {
// ...
}
class Derived_B : public Base {
// ...
}
class Join : public Derived_A, public Derived_B {
// ...
}
Depending on a template variable, I would like to conditionally choose to inherit A and/or B. (I understand with the diamond structure, A and B can be virtually inherited.) What I have exactly is:
template<bool HAS_A, bool HAS_B>
class Join : public Derived_A, // enable if HAS_A
public Derived_B // enable if HAS_B
{
// ...
}
I attempted to use std::enable_if_t, but I am not sure that will work when the boolean to it is false.