[英]Initialize tuple with class templated on each type of variadic template
[英]Wrapping each type in a variadic template in a templated class
給定一個可變參數模板Types...
,我想為包中的每個類型存儲A<>
。 這可以在A<>
的元組中完成,但我需要以編程方式派生所述元組的類型。
在c ++ 11/14/17中這樣的事情是否可能?
template <class T> class A { };
template <class... Types>
class B
{
// A tuple of A<>'s for each type in Types...
std::tuple<A<Type1>, A<Type2>, ...> data;
};
只需:
template <class... Types>
class B
{
std::tuple<A<Types>...> data;
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.