C++将参数包扩展为数组的元组

sha*_*ane 8 c++ variadic-templates

我想实例化一个类

template<typename ...Args>
class X {
private:
    std::tuple<std::array<Arg0, 255>, std::array<Arg1, 255>, ...> m_tuples; // For Arg in Args
}
Run Code Online (Sandbox Code Playgroud)

我知道这不是正确的C++,但是我怎样才能实现将类的参数包模板扩展到元组中保存的数组的效果?

Que*_*tin 11

template<typename ...Args>
class X {
private:
    std::tuple<std::array<Args, 255>...> m_tuples; // For Arg in Args
};
Run Code Online (Sandbox Code Playgroud)

......你没想到会如此接近,你呢:)

  • @shane请参阅http://stackoverflow.com/questions/17652412/what-are-the-rules-for-the-token-in-the-context-of-variadic-templates. (2认同)