我安装了 Visual C++ Compiler 2012 年 11 月 CTP并创建了一个 C++ 控制台项目.我在
I installed Visual C++ Compiler November 2012 CTP and created a C++ console project. I wrote this in
template<typename T>
void Test(T value){
}
template<typename T, typename... Args>
void Test(T value, Args... args){
Test(value);
Test(args...);
}
int main(){
Test(1,2,3);
}
然后我按 F6 在 IDE 中构建.我在第 4 行收到此错误
Then I pressed F6 to build in the IDE. I got this error on line 4
error C2143: syntax error : missing ',' before '...'
编译列表可变参数模板",所以我相信这应该可行.我确实理解智能感知可能不正确,但是编译器"应该可以工作.我不能从 IDE 构建吗?我必须在某处启用某些东西吗?int i{4};
似乎也不起作用,我确定这是有效的统一初始化.
The compile list "variadic templates" so I believe this should work. I do understand intellisense may be incorrect however the 'compiler' should work. Can I not build from the IDE? Do I have to enable something somewhere? int i{4};
doesn't seem to work either and I am sure thats valid uniform initialization.
在项目属性中,确保选择Microsoft Visual C++ Compiler Nov 2012 CTP:
In the Project Properties, make sure to select the Microsoft Visual C++ Compiler Nov 2012 CTP:
新工具链不会替换现有的 Visual C++ 2012 工具链,并且默认情况下未启用.它与现有工具链并排安装.
The new toolchain does not replace the existing Visual C++ 2012 toolchain, and it is not enabled by default. It's installed side-by-side with the existing toolchain.
如果您选择新的工具链,您的程序将编译无误.
If you select the new toolchain, your program will compiler without error.
这篇关于VS 2012 中的可变参数模板(Visual C++ 2012 年 11 月 CTP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!