Namespaces
Variants

C++11

Von de.cppreference.net
< cpp

C++11 ist die zweite Hauptversion von C++ und die wichtigste Aktualisierung seit C++98. Es wurden zahlreiche Änderungen eingeführt, um sowohl bestehende Praktiken zu standardisieren als auch die Abstraktionen zu verbessern, die C++‑Programmierern zur Verfügung stehen.

Bevor es am 12. August 2011 endgültig von der ISO genehmigt wurde, wurde der Name „C++0x“ verwendet, da eine Veröffentlichung vor 2010 erwartet wurde. Es dauerte 8 Jahre zwischen C++03 und C++11, daher ist es der bisher längste Abstand zwischen Versionen. Seitdem erfolgen C++‑Aktualisierungen alle 3 Jahre regelmäßig.

Folgende Funktionen wurden in C++11 übernommen:

Kernsprachfunktionen

Bibliotheksfunktionen

Header

Bibliotheksfunktionen

  • 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
  • std::begin
  • std::end
  • std::next
  • std::prev

Fehlberichte

In C++11 behobene Fehlberichte (741 Kern, 868 Bibliothek)
  1. ↑ 1.0 1.1 1.2 Die Behebung dieser Defekte fügte die folgenden Member‑Funktionen hinzu, die jedoch im C++98‑Modus vonlibstdc++ nicht verfügbar sind:

Compiler-Unterstützung

C++11‑Kernsprachfunktionen

C++11‑Funktion

 
Dokument(e)

 
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray
 
Embarcadero C++ Builder
IBM Open XL C++ for AIX
IBM Open XL C++ for z/OS
IBM XL C++
Sun/Oracle C++
HP aCC
Digital Mars C++
C99‑Präprozessor N1653 4.3 Ja 19.0 (2015)* (teilweise)*
19.26*
Ja 4.1 11.1 2015 7.0 8.4  Ja 17.1.0 1.1.0 10.1 5.9 A.06.25 Ja
static_assert  (FTM)* N1720 4.3 2.9 16.0* Ja 4.1 11.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 5.13 A.06.25 8.52
Rechte spitze Klammern N1757 4.3 Ja 14.0* Ja 4.1 11.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 12.1 5.13
Erweitertefriend‑Deklarationen N1791 4.7 2.9 16.0* Ja 4.1 11.1 (teilweise)
12.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 5.13 A.06.25
long long N1811 Ja Ja 14.0* Ja Ja Ja 2015 7.0 8.4  Ja 17.1.0 1.1.0 Ja Ja Ja Ja
auto N1984 4.4 Ja 16.0* Ja 3.9 11.0 (teilweise)*
12.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 5.13 A.06.25
Delegierende Konstruktoren  (FTM)* N1986 4.7 3.0 18.0* Ja 4.7 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 5.13 A.06.28
extern template N1987 3.3 Ja 12.0* Ja 3.9 9.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 5.13 A.06.25
constexpr  (FTM)* N2235 4.6 3.1 19.0 (2015)* Ja 4.6 13.0 (teilweise)
14.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 12.1 (teilweise)
13.1
5.13 A.06.28
char16_t undchar32_t  (FTM)* N2249 4.4 2.9 19.0 (2015)* Ja 4.4 12.1 (teilweise)*
14.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1* 5.13 A.06.27 8.52
Compiler-Unterstützung fürtype traits. N2255* N2255
N2984
N3142
4.3 (teilweise)*
4.8 (teilweise)*
5
3.0 14.0*
(teilweise)*
19.0 (2015)*
Ja 4.0 10.0 2015 8.4  Ja 17.1.0 1.1.0 13.1.3 5.13 6.16
Template‑Aliase  (FTM)* N2258 4.7 3.0 18.0* Ja 4.2 12.1 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1* 5.13 A.06.27
alignas N2341 4.8 3.0 19.0 (2015)* Ja 4.8 15.0 2015 7.0 8.6  Ja 17.1.0 1.1.0 13.1.2* 5.13
alignof N2341 4.5 2.9 19.0 (2015)* Ja 4.8 15.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13
Standardmäßige und gelöschte Funktionen N2346 4.4 3.0 18.0* Ja 4.1 12.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1 5.13 A.06.25
Stark typisierteenum N2347 4.4 2.9 16.0* (teilweise)
17.0*
Ja 4.0 13.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 12.1 5.13 A.06.25
Atomare Operationen N2427 4.4 3.1 17.0* Ja Ja 13.0 2015 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.14
nullptr N2431 4.6 2.9 16.0* Ja 4.2 12.1 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1 5.13 A.06.27 8.52
ExpliziteKonvertierungsoperatoren N2437 4.5 3.0 18.0* Ja 4.4 13.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 12.1 5.13 A.06.27
ref‑Qualifizierer  (FTM)* N2439 4.8.1 2.9 19.0 (2015)* Ja 4.7 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.28
Unicode‑Zeichenkettenliterale  (FTM)* N2442 4.4 3.0 19.0 (2015)* Ja 4.7 11.0* 2015 7.0 8.4  Ja 17.1.0 1.1.0 10.1*
13.1.1*
5.7 A.06.28 8.52
Roh‑Zeichenkettenliterale  (FTM)* N2442 4.5 Ja 18.0* Ja 4.7 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1, außer AIX xlC 13.1.3* 5.13 A.06.28 8.52
Inline‑Namensräume N2535 4.4 2.9 19.0 (2015)* Ja 4.5 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 5.13 A.06.28
Vererbte Konstruktoren  (FTM)* N2540 4.8 3.3 19.0 (2015)* Ja 4.8 15.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1* 5.13
Nachgestellte Funktionsrückgabetypen N2541 4.4 2.9 16.0* Ja 4.1 12.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 12.1 5.13 A.06.27
Uneingeschränkteunions N2544 4.6 3.0 19.0 (2015)* Ja 4.6 14.0* 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.28
Variadische Templates  (FTM)* N2242
N2555
4.3 (teilweise)*
4.4
2.9 18.0* Ja 4.3 (teilweise)*
4.3
12.1 2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 (teilweise)* 5.13 A.06.27
Ausdrucks‑SFINAE N2634 4.4 2.9 19.14* Ja 4.2 12.1 2015 7.0 8.4  Ja 17.1.0 1.1.0
Lokale und unbenannte Typen als Template‑Parameter N2657 4.5 2.9 16.0* Ja 4.2 12.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.27
Thread‑lokale Speicherung N2659 4.4 (teilweise)
4.8
3.3* 16.0* (teilweise)
19.0 (2015)*
Ja 4.8 11.1 (teilweise)
15.0*
2015 8.4  Ja 17.1.0 1.1.0 10.1 (teilweise)*
13.1.2 (teilweise)*
5.9 (teilweise) 8.52 (teilweise)
Dynamische Initialisierung und Zerstörung mit Nebenläufigkeit (magic statics)  (FTM)* N2660 4.3 2.9 19.0 (2015)* Ja Ja 11.1* 2015 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.25
Garbage Collection und reachability‑basierte Leckerkennung N2670  
Initialisierungslisten  (FTM)* N2672 4.4 3.1 18.0* Ja 4.5 13.0 (teilweise)
14.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.28
Nicht‑statische Datenelement‑Initialisierer  (FTM)* N2756 4.7 3.0 18.0* Ja 4.6 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.28
Attribute,[[noreturn]]  (FTM)* N2761 4.8 3.3 19.0 (2015)* Ja 4.2 12.1 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1* 5.13 A.06.27
[[carries_dependency]] N2556
N2643
3.3*   17.1.0*
Forward (undurchsichtige)enumDeklarationen N2764 4.6 3.1 17.0* Ja 4.5 11.1 (teilweise)
14.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 12.1 5.13
Benutzerdefinierte Literale  (FTM)* N2765 4.7 3.1 19.0 (2015)* Ja 4.8 15.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.14
Rvalue‑Referenzen  (FTM)* N2118
N2844
CWG1138
4.3 (teilweise)*
4.5
2.9 16.0* (teilweise)*
17.0*
Ja 4.5 11.1 (teilweise)*
12.0 (teilweise)*
14.0
2015 7.0* 8.4  Ja 17.1.0 1.1.0 12.1 5.13 A.06.25
Lambda‑Ausdrücke  (FTM)* N2550
N2658
N2927
4.5 3.1 16.0* (teilweise)*
17.0*
Ja 4.1 12.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.25
Bereichsbasierte for‑Schleife  (FTM)* N2930
N3271
4.6 3.0 17.0* Ja 4.5 13.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.2* 5.13 A.06.28
noexcept N3050 4.6 3.0 19.0 (2015)* Ja 4.5 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1* 5.13 A.06.28
Standardmäßige Verschiebe‑spezielle Member‑ Funktionen N3053 4.6 3.0 19.0 (2015)* Ja 4.5 14.0 2015 7.0 8.4  Ja 17.1.0 1.1.0 5.13 A.06.25
override undfinal N2928
N3206
N3272
4.7 2.9 14.0* (teilweise)
17.0*
Ja 4.8 12.0 (teilweise)*
14.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 13.1.1* 5.13
decltype  (FTM)* N2343
N3276
4.3 (teilweise)*
4.8.1
2.9 16.0* (teilweise)*
17.0*
Ja 4.2 (teilweise)*
4.8
11.0 (teilweise)*
12.0
2015 7.0 8.4  Ja 17.1.0 1.1.0 11.1 (teilweise)* 5.13 A.06.25 8.52 (teilweise)*
 

C++11‑Funktion
 

Dokument(e)
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray
 
Embarcadero C++ Builder
IBM Open XL C++ for AIX
IBM Open XL C++ for z/OS
IBM XL C++
Sun/Oracle C++
HP aCC
Digital Mars C++

C++11‑Bibliotheksfunktionen

C++11‑Funktion

 
Dokument(e)

 
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
 
IBM Open XL C/C++ for AIX*
Sun/Oracle C++*
Embarcadero C++ Builder*
Reguläre‑Ausdrücke‑Bibliothek N1429 4.9 2.8 Ja Ja  17.1.0
Typ‑Eigenschaften. N1836* N1836
N2240
N2244
N2255
N2342
N2984
N3142
4.3 (teilweise)*
4.8 (teilweise)*
5
3.0 14.0*
(teilweise)*
19.0 (2015)*
Ja  17.1.0 5.13 Ja
Member‑Funktionencbegin,cend,crbegin undcrend von Containern N1913
LWG1192
4.3 (teilweise)*
4.5
Ja* 16.0* Ja*  17.1.0
Garbage Collection und reachability‑basierte Leckerkennung (Bibliotheksunterstützung) N2670 6
(No‑op)*
3.4
(No‑op)*
19.0 (2015)*
(No‑op)*
Ja
(No‑op)* 
17.1.0
Geld‑, Zeit‑ und hexfloat‑I/O‑Manipulatoren N2071
N2072
5 3.8 19.0 (2015)* Ja  17.1.0 5.15
Verbot vonCOW (Copy‑on‑Write) std::basic_string N2668 5 Ja Ja Ja  17.1.0 Ja
 

C++11‑Funktion
 

Dokument(e)
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
 
IBM Open XL C/C++ for AIX*
Sun/Oracle C++*
Embarcadero C++ Builder*

* – Fahren Sie mit der Maus über eine mit dem Stern * markierte Zelle, um zusätzliche Popup‑Notizen zu sehen.
DRnn – die Nummer nn nach „DR“ bezeichnet die Ziel‑C++‑Revision, auf die der Defect Report angewendet wird, z. B. DR20 → C++20.

Externe Links

1.  C++11 – Wikipedia
2.  Funktionierende C++11‑Beispiele