gpt4 book ai didi

c++ - 最简单的template-template为什么编译不出来?

转载 作者:搜寻专家 更新时间:2023-10-30 23:58:07 25 4
gpt4 key购买 nike

以下代码不能用VC++ 2013 CTP编译。

template <template <class> A, class B>
void f(A<B>)
{}

输出结果如下:

error C2988: unrecognizable template declaration/definition
error C2059: syntax error : '<L_TEMPLATEDECL>'
error C2065: 'A' : undeclared identifier
error C2065: 'B' : undeclared identifier
error C2988: unrecognizable template declaration/definition
error C2059: syntax error : ')'

最佳答案

你是这个意思吗?

template <template <class> class A, class B>
void f(A<B>)
{}

关于c++ - 最简单的template-template为什么编译不出来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21823806/

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