I am writing a class that uses different policies stored in classes
I want to declare this class by simply selecting the policies by writing
my_great_class<policy45, policy22, policy12>
(There can be a varying number of policies)
which would translate automatically into:
struct empty_class{};
struct policy12: empty_class{
// code...
};
struct policy23: policy12{
// code...
};
struct policy45: policy23{
// code...
};
struct my_great_class: policy45{
// code...
};
I want to use subclasses to benefit from empty subclass optimisation which will diminish my memory footprint for my structures
Therefore, the following would be inaceptable to me:
template <typename... Ts>
struct my_great_class:Ts...{
}
There surely must be a way (?) to do recursively inherited subclasses with variadic template but I tried and couldn't find it.
Anyone knows how to do this?