gpt4 book ai didi

c++11 - 别名模板模板参数

转载 作者:行者123 更新时间:2023-12-04 09:05:48 25 4
gpt4 key购买 nike

是否可以使用 using 关键字为模板模板参数设置别名?

template <template<int> class T>
struct Foo {
using type = T;
};

谢谢

最佳答案

使用 (或typedef) 始终为类型 提供别名,从不为更高种类的类型 (模板模板参数)。您可以做的是在 int 上模板化别名本身:

template <template<int> class T>
struct Foo {
template <int X>
using type = T<X>;
};

关于c++11 - 别名模板模板参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43067334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com