c++variadic-templatespack-expansion

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?


Solution

  • 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 :)