shane
shane

Reputation: 1863

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?

Upvotes: 9

Views: 948

Answers (1)

Quentin
Quentin

Reputation: 63124

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

Upvotes: 12

Related Questions