在Visual C ++编译器2012年11月CTP中使用std :: initializer_list [英] Use std::initializer_list in Visual C++ Compiler November 2012 CTP

查看:68
本文介绍了在Visual C ++编译器2012年11月CTP中使用std :: initializer_list的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Visual Studio 2012中使用 std :: initializer_list s,就像此示例可以做到。我的操作系统是Windows 8 x64。

I want to use std::initializer_lists in Visual Studio 2012 like a guy in this example does. My operating system is Windows 8 x64.

因此,我最近安装了 Visual C ++编译器2012年11月CTP ,正如Microsoft所述,我更改了项目的平台工具集,以使用新的更新编译器。

Therefore I lately installed the Visual C++ Compiler November 2012 CTP and as mentioned by Microsoft, I changed the platform toolset of my project to use that new updated compiler.

但是即使这样做,也没有 std :: initializer_list < initializer_list> 标头可用。但是Microsoft的链接网站告诉我(标题为概述下),该更新将提供初始化程序列表。我重新启动了IDE和PC。我不确定这是否可能是由于我(不幸地)使用的是Visual Studio的德语版,并且编译器更新为英文。我在做什么错?

But even after doing so, there is neither a std::initializer_list nor a <initializer_list> header available. But the linked website from Microsoft tells me (under the headline "Overview") that initializer lists would be available with that update. I restarted both the IDE and my PC. I am not sure if it could be caused by the fact that I am (sadly) using the German edition of Visual Studio and the compiler update is in English. What am I doing wrong?

更新:尝试编译行 auto a = {0}; 被IntelliSense批评,编译器输出显示 Microsoft Visual C ++编译器2012年11月CTP仅用于测试目的。,然后编译器崩溃,并出现错误窗口,显示为 Microsoft(R)C / C ++编译器驱动程序已停止工作。没有任何新语法,所有内容都可以编译并与所选的新编译器一起正常工作。

Update: Trying to compile the line auto a = { 0 }; which is criticized by IntelliSense the compiler output shows 'Microsoft Visual C++ Compiler Nov 2012 CTP' is for testing purposes only. and then compiler crashes and a error window appears which reads Microsoft (R) C/C++ Compiler Driver has stopped working. Without any new syntax, everything compiles and works fine with the new compiler selected.

推荐答案

(我在Microsoft和Dinkumware公司工作,维护VC的标准库实现。)

(I work for Microsoft and with Dinkumware to maintain VC's Standard Library implementation.)

[danijar]

[danijar]


确定是否可能是由于我(严重)使用德语版的Visual Studio而编译器的更新是英文。

I am not sure if it could be caused by the fact that I am (sadly) using the German edition of Visual Studio and the compiler update is in English.

不幸的是,仅英语的CTP不支持德语VS。

Unfortunately, the English-only CTP does not support German VS.

编译驱动程序 cl.exe是调用编译器前端c1xx.dll的原因,编译器后端c2.dll和链接器link.exe。编译器驱动程序崩溃是非常不寻常的。我推测它正在尝试显示CTP添加的错误消息之一,但是由于CTP没有更新德语资源,因此编译器驱动程序无法加载错误消息并继续崩溃。

The "compiler driver" cl.exe is what invokes the compiler front-end c1xx.dll, the compiler back-end c2.dll, and the linker link.exe. It is very unusual for the compiler driver to crash. I speculate that it's attempting to display one of the error messages that were added by the CTP, but since the CTP didn't update the German resources, the compiler driver can't load the error message and proceeds to crash.

请注意,这与前端或后端的内部编译器错误或恰巧错误发出的正常编译器错误不同。 (发布CTP后,许多ICE和虚假错误已得到修复。)

Note that this is different from an Internal Compiler Error in the front-end or back-end, or a normal compiler error that happens to be incorrectly emitted. (Many ICEs and bogus errors have been fixed after the CTP was released.)


但是即使这样做,也没有std: :initializer_list或< initializer_list>

But even after doing so, there is neither a std::initializer_list nor a <initializer_list> header available.

已安装CTP的< initializer_list>在一个特殊的位置。 (它实际上是由编译器团队编写的。)

The CTP installed <initializer_list> in a special location. (It was actually written by the compiler team.)

在命令行上,使用CTP并放入< initializer_list>包含路径上的(假定默认位置):

On the command line, the incantations to use the CTP and put <initializer_list> on the include path are (assuming default locations):

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
set PATH=C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2012 CTP\bin;%PATH%
set INCLUDE=C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2012 CTP\include;%INCLUDE%




试图自动编译行a = {0};受到IntelliSense的批评

Trying to compile the line auto a = { 0 }; which is criticized by IntelliSense

这已记录在案-Intellisense并未由CTP更新,因此它将无法识别任何新功能。

This was documented - Intellisense was not updated by the CTP, therefore it will not recognize any of the new features.

[rubenvb]

[rubenvb]


C ++标准库未使用编译器,使您没有像样的< tuple>和< intializer_list> (这包括所有标准容器的括号初始化列表构造函数的省略)

The C++ Standard Library was not updated with the compiler, leaving you without decent <tuple> and <intializer_list> (this includes the omission of the braced init list constructors for all standard containers)

您可能有兴趣了解我们已更新标准库以完全支持作用域枚举和初始化列表。这包括当前工作文件(N3485)规定的所有initializer_list重载,以及安装< initializer_list>与所有其他标准标头一起放在通常的位置。 (这也是Dinkumware的正式副本,尽管它与编译器团队的伪造版本之间的差异主要是装饰性的。)无论何时何地,这些内容都将在下一个公开发行版中提供。我们的下一个任务是使用显式转换运算符和可变参数模板更新标准库,以替换我们的脆弱模拟。

You may be interested to learn that we've updated the standard library to fully support scoped enums and initializer lists. This includes all initializer_list overloads mandated by the current Working Paper (N3485), plus installing <initializer_list> in the usual location along with all other standard headers. (It is also Dinkumware's official copy, although the differences between it and the compiler team's "fake" version were mostly cosmetic.) This stuff will be available in the next public release, whenever and whatever that is. Our next task is to update the standard library with explicit conversion operators and variadic templates, replacing our brittle simulations.

这篇关于在Visual C ++编译器2012年11月CTP中使用std :: initializer_list的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆