I have a filter class that takes two template parameters, the number of inputs and the number of outputs.
template<int Ins, int Outs>
class Filter
{
// implementation
};
Sometimes I need to chain multiple filters in series so I was thinking to wrap them in a class
template<int... args>
class Chain
{
};
so that when I use the chain
Chain<5, 10, 25, 15> chain;
it unrolls the args into a tuple to end up with something like this in the Chain class
std::tuple<Filter<5, 10>, Fiter<10, 25>, Filter<25, 15>> filters;
Is something like this possible? I'm fairly new to these concepts and can't wrap my head around it.
We can do this in three lines and no recursion:
Demo.