Visual Studio 2012 中的 C++11 功能
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7421825/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C++11 features in Visual Studio 2012
提问by HighCommander4
A preview version of Visual Studio 2012 (the next version after VS2010) is now available.
Visual Studio 2012 预览版(VS2010 之后的下一个版本)现已推出。
Does anyone know what new C++11 features it supports? (I'm not in a position to try it out at the moment).
有谁知道它支持哪些新的 C++11 特性?(我目前无法尝试)。
采纳答案by Joel Coehoorn
It's worth noting that Visual Studio 2010 already had quite a bit of early C++11 support. So to summarize what is already linked to in other answers, here is what is new in Visual Studio 11 that was not part of Visual Studio 2010:
值得注意的是,Visual Studio 2010 已经有相当多的早期 C++11 支持。因此,总结一下其他答案中已经链接的内容,这里是 Visual Studio 11 中不属于 Visual Studio 2010 的新内容:
- rvalue references to version 2.1from 2.0
- lambdas to version 1.1from 1.0.
- decltype to version 1.1from 1.0(not yet available in developer preview)
- Improved, but still incomplete, Alignment
- completed strongly-typed enums
- forward declared enums
- Standard layout and trivial types
- Atomics
- Strong compare and exchange
- Bi-directional fences
- Data-dependency ordering
- Range-based for loop
- 从 2.0到2.1 版的右值引用
- lambdas从 1.0到1.1 版。
- decltype从 1.0到1.1 版(尚未在开发者预览版中提供)
- 改进,但仍不完整,对齐
- 完整的强类型枚举
- 前向声明的枚举
- 标准布局和普通类型
- 原子
- 强对比和交流
- 双向围栏
- 数据依赖排序
- 基于范围的 for 循环
In early November 2012, Microsoft announcedthe Visual C++ Compiler November 2012 CTP, which adds more C++11 functionality to Visual Studio 2012:
2012 年 11 月上旬,Microsoft发布了 Visual C++ Compiler 2012 年 11 月 CTP,它为 Visual Studio 2012 添加了更多 C++11 功能:
- uniform initialization
- initializer lists
- variadic templates
- function template default arguments
- delegating constructors
- explicit conversion operators
- raw strings
回答by Drahakar
回答by Alexandre C.
There is a list there. What strikes me the most is the features which are still missing:
有一个列表存在。最让我印象深刻的是仍然缺少的功能:
- They saidthey would implement variadic templates as a priority and they didn't.
- We will still have to declare move constructors by hand for many classes, since there is no delegating constructors.
- Inheriting constructors aren't present, and this would really be needed for some code
- No uniform initialization, in particular no initializer lists. This sucks when you have used them with g++.
- Still no correct thread local storage. So you're stuck with
boost::thread_specific_ptr
for a while.
- 他们说他们会优先实现可变参数模板,但他们没有。
- 我们仍然需要为许多类手动声明移动构造函数,因为没有委托构造函数。
- 不存在继承构造函数,某些代码确实需要这样做
- 没有统一的初始化,特别是没有初始化列表。当您将它们与 g++ 一起使用时,这很糟糕。
- 仍然没有正确的线程本地存储。所以你被困
boost::thread_specific_ptr
了一段时间。
All the other features which are yet missing are mainly stuff you can live without. What I list here is just what nags me everyday when working with VS10. It's just so irritating that they didn't work on the compiler at all.
尚未缺少的所有其他功能主要是您可以没有的东西。我在这里列出的正是使用 VS10 时每天困扰我的事情。他们根本没有在编译器上工作,真是太令人恼火了。
EDIT:I shall also add that emplace_back
(one great feature for the standard library containers) isn't correctly implemented.
编辑:我还要补充一点emplace_back
(标准库容器的一项重要功能)没有正确实现。
回答by Kate Gregory
During GoingNative in Feb 2012, STL announced that range-for will be in VS11 starting with the beta, which is expected Feb 29th. A recording of the talkis available. "The Reveal" is at the one-hour 38 minute mark.
在 2012 年 2 月的 GoingNative 期间,STL 宣布 range-for 将在 VS11 中从测试版开始,预计将于 2 月 29 日发布。提供谈话录音。“The Reveal”是在1小时38分钟的标记处。
回答by Steve Townsend
回答by Abhinav
Try this video by Herb Sutter. This fellow dont need introduction!!!
试试 Herb Sutter 的这个视频。这家伙不用介绍!!!