<分区>
Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?
我有一个静态模板方法test
在类里面A
这需要一个 bool
模板参数。当我尝试这样调用函数时:
x = A::test<true>(...);
解析器在处理 <
时会报错作为小于运算符。我如何告诉编译器这是一个模板实例化而不是一个小于运算符?
<分区>
Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?
我有一个静态模板方法test
在类里面A
这需要一个 bool
模板参数。当我尝试这样调用函数时:
x = A::test<true>(...);
解析器在处理 <
时会报错作为小于运算符。我如何告诉编译器这是一个模板实例化而不是一个小于运算符?
最佳答案
A::template test<true>(...);
阅读Where and why do I have to put the "template" and "typename" keywords?
关于C++ 模板解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14625510/