Suppose I have compile time polymorphic inheritance structure:
enum class Enum1 {
Undefined = 0;
/* ... */
};
enum class Enum2 {
Undefined = 0;
/* ... */
};
template<Enum1 A, Enum2 B>
struct Base {
int state;
};
struct Derived : public Base <Enum1::Undefined, Enum2::Undefined>> {
int statederived;
};
Is there a way to do something like:
template<Base<Enum1, Enum2> DerivedTemplate>
using Function = std::function<void (DerivedTemplate&)>;
to accomplish:
Function<Derived> & function;
And or create a class based upon these derived types with metaprogramming?
I could just create a class for each of these derived types, but I'd like to avoid that since I have around 50 of them.
Essentially, I would like to avoid clashes of different derived types with the same template arguments, while still enforcing the conceptual constraints.