标签:
|
1
|
auto otherVariable = 5;//otherVariable被按照int型来编译 |
|
1
|
auto someStrangeCallableType = boost::bind(&SomeFunction,_2,_1,someObject); |
|
1
2
|
int someInt;decltype(someInt) otherIntegerVariable = 5; |
|
1
|
for(vector<int>::const_iteratoritr=myvec.begin(); itr!=myvec.end(); ++itr) |
|
1
|
for(auto itr = myvec.begin(); itr != myvec.end(); ++itr) |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include<vector>int main(){ const std::vector<int>v(1); auto a = v[0];//a为int类型 decltype(v[0]) b = 0;//b为const int&类型,即std::vector<int>::operator[](size_type)const的返回类型 auto c = 0;//c为int类型 auto d = c;//d为int类型 decltype(c) e;//e为int类型,c实体的类型 decltype((c)) f = e;//f为int&类型,因为(c)是左值 decltype(0) g;//g为int类型,因为0是右值 return 0;} |
|
1
2
3
4
5
|
int my_array[5]={1, 2, 3, 4, 5};for(int& x : my_array){x *= 2;} |
|
C++11 Core Language Features
|
Visual Studio 2010
|
Visual Studio 2012
|
Visual Studio 2013
|
|---|---|---|---|
|
Rvalue referencesv0.1,v1.0,v2.0,v2.1,v3.0
|
v2.0
|
v2.1*
|
v2.1*
|
|
ref-qualifiers
|
No
|
No
|
No
|
|
Non-static data member initializers
|
No
|
No
|
Yes
|
|
Variadic templatesv0.9,v1.0
|
No
|
No
|
Yes
|
|
Initializer lists
|
No
|
No
|
Yes
|
|
static_assert
|
Yes
|
Yes
|
Yes
|
|
autov0.9,v1.0
|
v1.0
|
v1.0
|
v1.0
|
|
Trailing return types
|
Yes
|
Yes
|
Yes
|
|
Lambdasv0.9,v1.0,v1.1
|
v1.0
|
v1.1
|
v1.1
|
|
decltypev1.0,v1.1
|
v1.0
|
v1.1**
|
v1.1
|
|
Right angle brackets
|
Yes
|
Yes
|
Yes
|
|
Default template arguments for function templates
|
No
|
No
|
Yes
|
|
Expression SFINAE
|
No
|
No
|
No
|
|
Alias templates
|
No
|
No
|
Yes
|
|
Extern templates
|
Yes
|
Yes
|
Yes
|
|
Yes
|
Yes
|
Yes
|
|
|
Strongly typed enums
|
Partial
|
Yes
|
Yes
|
|
Forward declared enums
|
No
|
Yes
|
Yes
|
|
No
|
No
|
No
|
|
|
constexpr
|
No
|
No
|
No
|
|
TR1
|
Partial
|
Partial
|
|
|
Delegating constructors
|
No
|
No
|
Yes
|
|
Inheriting constructors
|
No
|
No
|
No
|
|
Explicit conversion operators
|
No
|
No
|
Yes
|
|
char16_t/char32_t
|
No
|
No
|
No
|
|
Unicode string literals
|
No
|
No
|
No
|
|
Raw string literals
|
No
|
No
|
Yes
|
|
Universal character names in literals
|
No
|
No
|
No
|
|
User-defined literals
|
No
|
No
|
No
|
|
Standard-layout and trivial types
|
No
|
Yes
|
Yes
|
|
Defaulted and deleted functions
|
No
|
No
|
Yes*
|
|
Extended friend declarations
|
Yes
|
Yes
|
Yes
|
|
Extended sizeof
|
No
|
No
|
No
|
|
Inline namespaces
|
No
|
No
|
No
|
|
Unrestricted unions
|
No
|
No
|
No
|
|
Local and unnamed types as template arguments
|
Yes
|
Yes
|
Yes
|
|
Range-based for-loop
|
No
|
Yes
|
Yes
|
|
override and finalv0.8,v0.9,v1.0
|
Partial
|
Yes
|
Yes
|
|
Minimal GC support
|
Yes
|
Yes
|
Yes
|
|
noexcept
|
No
|
No
|
No
|
|
C++11 Core Language Features: Concurrency
|
Visual Studio 2010
|
Visual Studio 2012
|
Visual Studio 2013
|
|---|---|---|---|
|
Reworded sequence points
|
N/A
|
N/A
|
N/A
|
|
Atomics
|
No
|
Yes
|
Yes
|
|
Strong compare and exchange
|
No
|
Yes
|
Yes
|
|
Bidirectional fences
|
No
|
Yes
|
Yes
|
|
Memory model
|
N/A
|
N/A
|
N/A
|
|
Data-dependency ordering
|
No
|
Yes
|
Yes
|
|
Data-dependency ordering: function annotation
|
No
|
No
|
No
|
|
exception_ptr
|
Yes
|
Yes
|
Yes
|
|
quick_exit
|
No
|
No
|
No
|
|
Atomics in signal handlers
|
No
|
No
|
No
|
|
Thread-local storage
|
Partial
|
Partial
|
Partial
|
|
Magic statics
|
No
|
No
|
No
|
|
C++11 Core Language Features: C99
|
Visual Studio 2010
|
Visual Studio 2012
|
Visual Studio 2013
|
|---|---|---|---|
|
__func__
|
Partial
|
Partial
|
Partial
|
|
C99 preprocessor
|
Partial
|
Partial
|
Partial
|
|
long long
|
Yes
|
Yes
|
Yes
|
|
Extended integer types
|
N/A
|
N/A
|
N/A
|
标签:
原文地址:http://www.cnblogs.com/destim/p/5544690.html