【发布时间】:2014-08-28 09:27:41
【问题描述】:
我正在学习 C++,我想知道如何为 std::tuple 创建别名。
我想做你可以用std::tuple 做的事情,但使用另一个名字。有可能吗?
谢谢。
【问题讨论】:
我正在学习 C++,我想知道如何为 std::tuple 创建别名。
我想做你可以用std::tuple 做的事情,但使用另一个名字。有可能吗?
谢谢。
【问题讨论】:
template <typename... Args>
using my_tuple = std::tuple<Args...>;
【讨论】:
您可以通过template alias 做到这一点
template< class... tupleArgs > using newname = std::tuple< tupleArgs... >;
int main()
{
newname<int, std::string, double> t1;
return 0;
}
【讨论】: