获取第N种可变参数模板模板? [英] Get the Nth type of variadic template templates?
本文介绍了获取第N种可变参数模板模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取第N种可变参数模板模板?例如,
How to get the Nth type of variadic template templates? For example
template<typename... Args>
class MyClass
{
Args[0] mA; // This is wrong. How to get the type?
};
推荐答案
您可以使用 std: :tuple
:
#include<tuple>
template<typename... Args>
class MyClass
{
typename std::tuple_element<0, std::tuple<Args...> >::type mA;
};
这篇关于获取第N种可变参数模板模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文