Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ expand parameter pack to tuple of arrays

I would like to instantiate a class like

template<typename ...Args>
class X {
private:
    std::tuple<std::array<Arg0, 255>, std::array<Arg1, 255>, ...> m_tuples; // For Arg in Args
}

I know this is not correct C++, but how could I achieve the effect of expanding the parameter pack template of the class to the arrays held within the tuple?

like image 374
shane Avatar asked Dec 07 '16 22:12

shane


1 Answers

template<typename ...Args>
class X {
private:
    std::tuple<std::array<Args, 255>...> m_tuples; // For Arg in Args
};

... you didn't expect to be so close, did you :)

like image 114
Quentin Avatar answered Nov 09 '22 02:11

Quentin