我希望能够使用模板包声明一个类,这样类本身将有一个成员变量元组,它将每个模板包成员包装在某种容器类型中。基本目标如下:
template <typename Types...>
class VectorOfMembers
{
public:
// Member tuple where each element is expanded in a container
std::tuple<std::vector<Type[1]>, std::vector<Type[2]>, std::vector<TypeN...>>
};
理想情况下,我希望能够将任何模板化对象作为包装类型。
答案 0 :(得分:6)
嗯,你差不多了:
template <typename... Types>
class VectorOfMembers
{
public:
// Member tuple where each element is expanded in a container
std::tuple<std::vector<Types>...> tuple;
};