I'm trying to conditionally add types to a tuple template type based on some compile time condition, as follows:
template <typename T>
class Base { ... }
template <int I>
class Derived : public Base<std::tuple<std::conditional<I % 8 == 0, int, void>::type,
std::conditional<I % 4 == 0, double, void>::type,
std::conditional<I % 2 == 0, float, void>::type>>
{ ... }
I understand that this isn't valid code, but conceptually I'm trying to conditionally add types to the tuple's list. I would like the type to be skipped when the conditional resolves to void
.
Is there a way to do something like this?