I need to pass arguments to a wrapper class that looks as minimal example like this:
template<class TStack, unsigned int TBins>
class Wrapper : Stack<......>
{
std::array<TStack, TBins> m_oStacks;
template<typename ... Args>
Wrapper(std::initializer_list<const unsigned int> const& size, Args&&... args)
: Stack<.......>(args), m_oStacks{5,2,3,4,5,6,7,8,9,10}
//, m_oStacks(size) //,m_oStacks{size} //,m_oStacks{{size}}
{
//m_oStacks = { size };
}
};
I tried to init the array with the initializer_list size but nothing works (commented parts of the source) only the constant {5,2,3,4,5,6,7,8,9,10} part does
Someone know the reason and a fix?
Sincerely Matyro
Edit 1: The main problem is that TStack does (in most cases) not have a default constructor so i need to initialize the array at construction
With
std::initializer_list
:DEMO
With
std::array
:DEMO 2