On this page
C++11
C++11 is the second major version of C++ and the most important update since C++98. A large number of changes were introduced to both standardize existing practices and improve the abstractions available to the C++ programmers.
Before it was finally approved by ISO on 12 August 2011, the name 'C++0x' was used because it was expected to be published before 2010. It took 8 years between C++03 and C++11, so it has become the longest interval between versions so far. Since then, currently, C++ updates every 3 years regularly.
Following features were merged into C++11:
- From TR1: all of TR1 except Special Functions.
- From Boost: The thread library,
exception_ptr,error_codeanderror_condition, iterator improvements (begin,end,next,prev) - From C: C-style Unicode conversion functions
Core language features
autoanddecltype- defaulted and deleted functions
finalandoverride- trailing return type
- rvalue references
- move constructors and move assignment operators
- scoped enums
constexprand literal types- list initialization
- delegating and inherited constructors
- brace-or-equal initializers
nullptrlong long- char16_t and char32_t
- type aliases
- variadic templates
- generalized (non-trivial) unions
- generalized PODs (trivial types and standard-layout types)
- Unicode string literals
- user-defined literals
- attributes
- lambda expressions
noexceptspecifier andnoexceptoperatoralignofandalignas- multithreaded memory model
- thread-local storage
- GC interface (removed in C++23)
- range-for (based on a Boost library)
static_assert(based on a Boost library)
Library features
Headers
<array><atomic><cfenv><chrono><cinttypes><condition_variable><cstdint><cuchar><forward_list><future><initializer_list><mutex><random><ratio><regex><scoped_allocator><system_error><thread><tuple><typeindex><type_traits><unordered_map><unordered_set>
Library features
- concurrency support library
emplace()and other use of rvalue references throughout all parts of the existing librarystd::unique_ptrstd::move_iteratorstd::initializer_list- stateful and scoped allocators
std::forward_list- chrono library
- ratio library
- new algorithms:
std::all_of,std::any_of,std::none_of,std::find_if_not,std::copy_if,std::copy_n,std::move,std::move_backward,std::random_shuffle,std::shuffle,std::is_partitioned,std::partition_copy,std::partition_point,std::is_sorted,std::is_sorted_until,std::is_heap,std::is_heap_until,std::minmax,std::minmax_element,std::is_permutation,std::iota,std::uninitialized_copy_n- Unicode conversion facets
std::functionstd::exception_ptrstd::error_codeandstd::error_condition- iterator improvements:
- Unicode conversion functions
Defect reports
Compiler support
Main Article: C++11 compiler support
C++11 core language features
| C++11 feature |
Paper(s) |
GCC
|
Clang
|
MSVC
|
Apple Clang
|
EDG eccp
|
Intel C++
|
IBM XL C++
|
IBM Open XL C++ for AIX
|
IBM Open XL C++ for z/OS
|
Sun/Oracle C++
|
Embarcadero C++ Builder
|
Cray
|
Nvidia HPC C++ (ex PGI)*
|
Nvidia nvcc
|
HP aCC
|
Digital Mars C++
|
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| C99 preprocessor | N1653 | 4.3 | Yes | 19.0 (2015)* (partial)* 19.26* |
Yes | 4.1 | 11.1 | 10.1 | 17.1.0 | 1.1.0 | 5.9 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | Yes | |
static_assert |
N1720 | 4.3 | 2.9 | 16.0* | Yes | 4.1 | 11.0 | 11.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | 8.52 | |
| Right angle brackets | N1757 | 4.3 | Yes | 14.0* | Yes | 4.1 | 11.0 | 12.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | |||
Extended friend declarations |
N1791 | 4.7 | 2.9 | 16.0* (partial) 18.0* |
Yes | 4.1 | 11.1* 12.0 |
11.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | ||
long long |
N1811 | Yes | Yes | 14.0* | Yes | Yes | Yes | Yes | 17.1.0 | 1.1.0 | Yes | Yes | 8.4 | 2015 | 7.0 | Yes | Yes | |
| Compiler support for type traits | N1836 N2518* N2984 N3142 |
4.3* 4.8* 5 |
3.0 | 14.0* (partial)* 19.0 (2015)* |
Yes | 4.0 | 10.0 | 13.1.3 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 6.16 | |||
auto |
N1984 | 4.4 | Yes | 16.0* | Yes | 3.9 | 11.0 (v0.9) 12.0 |
11.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | ||
| Delegating constructors | N1986 | 4.7 | 3.0 | 18.0* | Yes | 4.7 | 14.0 | 11.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
extern template |
N1987 | 3.3 | Yes | 12.0* | Yes | 3.9 | 9.0 | 11.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | ||
constexpr |
N2235 | 4.6 | 3.1 | 19.0 (2015)* | Yes | 4.6 | 13.0* 14.0 |
12.1* 13.1 |
17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Template aliases | N2258 | 4.7 | 3.0 | 18.0* | Yes | 4.2 | 12.1 | 13.1.1* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | ||
char16_t and char32_t |
N2249 | 4.4 | 2.9 | 19.0 (2015)* | Yes | 4.4 | 12.1* 14.0 |
13.1.1* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | 8.52 | |
alignas |
N2341 | 4.8 | 3.0 | 19.0 (2015)* | Yes | 4.8 | 15.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.6 | 2015 | 7.0 | |||
alignof |
N2341 | 4.5 | 2.9 | 19.0 (2015)* | Yes | 4.8 | 15.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | |||
| Defaulted and deleted functions | N2346 | 4.4 | 3.0 | 18.0* | Yes | 4.1 | 12.0 | 13.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | ||
Strongly-typed enum |
N2347 | 4.4 | 2.9 | 17.0* | Yes | 4.0 | 13.0 | 12.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | ||
| Atomic operations | N2427 | 4.4 | 3.1 | 17.0* | Yes | Yes | 13.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.14 | Yes | 8.4 | 2015 | ||||
nullptr |
N2431 | 4.6 | 2.9 | 16.0* | Yes | 4.2 | 12.1 | 13.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | 8.52 | |
| Explicit conversion operators | N2437 | 4.5 | 3.0 | 18.0* | Yes | 4.4 | 13.0 | 12.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | ||
| ref-qualifiers | N2439 | 4.8.1 | 2.9 | 19.0 (2015)* | Yes | 4.7 | 14.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Unicode string literals | N2442 | 4.4 | 3.0 | 19.0 (2015)* | Yes | 4.7 | 11.0* | 10.1* 13.1.1* |
17.1.0 | 1.1.0 | 5.7 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | 8.52 | |
| Raw string literals | N2442 | 4.5 | Yes | 18.0* | Yes | 4.7 | 14.0 | 13.1.1, except AIX xlC 13.1.3* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | 8.52 | |
| Inline namespaces | N2535 | 4.4 | 2.9 | 19.0 (2015)* | Yes | 4.5 | 14.0 | 11.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Inheriting constructors | N2540 | 4.8 | 3.3 | 19.0 (2015)* | Yes | 4.8 | 15.0 | 13.1.1* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | |||
| Trailing function return types | N2541 | 4.4 | 2.9 | 16.0* | Yes | 4.1 | 12.0 | 12.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | ||
| Unrestricted unions | N2544 | 4.6 | 3.0 | 19.0 (2015)* | Yes | 4.6 | 14.0* | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Variadic templates | N2242 N2555 |
4.3 (N2242) 4.4 |
2.9 | 18.0* | Yes | 4.3 (N2242) 4.3 |
12.1 | 11.1 (N2242) | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | ||
| Expression SFINAE | N2634 | 4.4 | 2.9 | 19.14* | Yes | 4.2 | 12.1 | 17.1.0 | 1.1.0 | Yes | 8.4 | 2015 | 7.0 | |||||
| Local and unnamed types as template parameters | N2657 | 4.5 | 2.9 | 16.0* | Yes | 4.2 | 12.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | ||
| Thread-local storage | N2659 | 4.4 (partial) 4.8 |
3.3* | 16.0* (partial) 19.0 (2015)* |
Yes | 4.8 | 11.1 (partial) 15.0* |
10.1 (partial)* 13.1.2 (partial)* |
17.1.0 | 1.1.0 | 5.9 (partial) | Yes | 8.4 | 2015 | 8.52 (partial) | |||
| Dynamic initialization and destruction with concurrency (magic statics) | N2660 | 4.3 | 2.9 | 19.0 (2015)* | Yes | Yes | 11.1* | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | A.06.25 | |||
| Garbage Collection and Reachability-Based Leak Detection | N2670 | |||||||||||||||||
| Initializer lists | N2672 | 4.4 | 3.1 | 18.0* | Yes | 4.5 | 13.0 (partial) 14.0 |
13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Non-static data member initializers | N2756 | 4.7 | 3.0 | 18.0* | Yes | 4.6 | 14.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Attributes | N2761 | 4.8 | 3.3 | 19.0 (2015)* | Yes | 4.2 | 12.1 | 13.1.1* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.27 | ||
Forward (opaque) enum declarations |
N2764 | 4.6 | 3.1 | 17.0* | Yes | 4.5 | 11.1 (partial) 14.0 |
12.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | |||
| User-defined literals | N2765 | 4.7 | 3.1 | 19.0 (2015)* | Yes | 4.8 | 15.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.14 | Yes | 8.4 | 2015 | 7.0 | |||
| Rvalue references | N2118 N2844 CWG1138 |
4.3 (N2118) 4.5 |
2.9 | 16.0* (N2844) 17.0* |
Yes | 4.5 | 11.1 (N2118) 12.0 (N2844) 14.0 |
12.1 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0* | A.06.25 | ||
| Lambda expressions | N2550 N2658 N2927 |
4.5 | 3.1 | 16.0* (N2658) 17.0* |
Yes | 4.1 | 12.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | ||
| Range-for loop | N2930 N3271 |
4.6 | 3.0 | 17.0* | Yes | 4.5 | 13.0 | 13.1.2* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
noexcept |
N3050 | 4.6 | 3.0 | 19.0 (2015)* | Yes | 4.5 | 14.0 | 13.1.1* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.28 | ||
| Defaulted move special member functions | N3053 | 4.6 | 3.0 | 19.0 (2015)* | Yes | 4.5 | 14.0 | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | |||
override and final |
N2928 N3206 N3272 |
4.7 | 2.9 | 14.0* (partial) 17.0* |
Yes | 4.8 | 12.0 (N2928) 14.0 |
13.1.1* | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | |||
decltype |
N2343 N3276 |
4.3 (N2343) 4.8.1 |
2.9 | 16.0* | Yes | 4.2 (N2343) 4.8 |
11.0 (N2343) 12.0 |
11.1 (N2343) | 17.1.0 | 1.1.0 | 5.13 | Yes | 8.4 | 2015 | 7.0 | A.06.25 | 8.52 (N2343) | |
C++11 feature |
Paper(s) |
GCC
|
Clang
|
MSVC
|
Apple Clang
|
EDG eccp
|
Intel C++
|
IBM XL C++
|
IBM Open XL C++ for AIX
|
IBM Open XL C++ for z/OS
|
Sun/Oracle C++
|
Embarcadero C++ Builder
|
Cray
|
Nvidia HPC C++ (ex PGI)*
|
Nvidia nvcc
|
HP aCC
|
Digital Mars C++
|
C++11 library features
| C++11 feature |
Paper(s) |
GCC libstdc++
|
Clang libc++
|
MSVC STL
|
Apple Clang*
|
IBM Open XL C/C++ for AIX*
|
Sun/Oracle C++*
|
Embarcadero C++ Builder*
|
|
|---|---|---|---|---|---|---|---|---|---|
| Type traits | N1836 N2240 N2244 N2255 N2342 N2984 N3142 |
4.3* 4.8* 5 |
3.0 | 14.0* (partial)* 19.0 (2015)* |
Yes | 17.1.0 | 5.13 | Yes | |
| Garbage Collection and Reachability-Based Leak Detection (library support) | N2670 | 6 (no-op)* |
3.4 (no-op)* |
19.0 (2015)* (no-op)* |
Yes (no-op)* |
17.1.0 | |||
| Money, Time, and hexfloat I/O manipulators | N2071 N2072 |
5 | 3.8 | 19.0 (2015)* | Yes | 17.1.0 | 5.15 | ||
Disallowing COW (copy-on-write) std::basic_string |
N2668 | 5 | Yes | Yes | Yes | 17.1.0 | Yes | ||
| Regular expressions library | N1429 | 4.9 | ? | ? | Yes | 17.1.0 | |||
C++11 feature |
Paper(s) |
GCC libstdc++
|
Clang libc++
|
MSVC STL
|
Apple Clang*
|
IBM Open XL C/C++ for AIX*
|
Sun/Oracle C++*
|
Embarcadero C++ Builder*
|
* - hover over a cell marked with the star * to see additional pop-up notes.
DRnn - the number nn after "DR" denotes target C++ revision the Defect Report is applied to, e.g., DR20 → C++20.
External links
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/11