Namespaces
Variants

C++17

Von de.cppreference.net
< cpp

C++17 ist eine Hauptversion, die auf die Nebenversion C++14 folgt und neue Sprach- und Bibliotheksfunktionen einführt. Der Standard wurde im Dezember 2017 veröffentlicht.

Die folgenden Merkmale wurden in C++17 eingearbeitet:

Veraltete Merkmale

Entfernte Merkmale
Veraltete Merkmale (deprecated)
  • std::iterator,
  • std::raw_storage_iterator,
  • std::get_temporary_buffer,
  • std::is_literal_type,
  • std::result_of,
  • alle von <codecvt>

Neue Sprachmerkmale

Neue Header

Neue Bibliotheksmerkmale

Dienstprogrammtypen

Speicherverwaltung

  • Uninitialisierte Speicheralgorithmen
    • std::destroy_at
    • std::destroy
    • std::destroy_n
    • std::uninitialized_move
    • std::uninitialized_value_construct
  • weak_from_this
  • std::pmr::memory_resource und std::polymorphic_allocator
  • std::aligned_alloc
  • transparentes std::owner_less
  • Array-Unterstützung für std::shared_ptr
  • Allokationsfunktionen mit expliziter Ausrichtung

Kompilzeitprogrammierung

Algorithmen

  • std::clamp
  • Parallele Algorithmen und Ausführungsrichtlinien
  • std::inclusive_scan
  • std::exclusive_scan
  • std::gcd
  • std::lcm
  • std::reduce

Iteratoren und Container

Numerik

Sonstiges

Fehlerberichte (Defect Reports)

In C++17 behobene Fehlerberichte (290 Kern, 363 Bibliothek)

Compilerunterstützung

C++17 Kernsprachmerkmale

C++17 Merkmal

 
Papier(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
DR11: Neue auto Regeln für direkte Listeninitialisierung N3922 5 3.8 19.0 (2015)* Ja 4.10.1 17.0 17.7 11.0 11.0  10.3 17.1.0
typename in einem template template parameter N4051 5 3.5 19.0 (2015)* Ja 4.10.1 17.0 17.7 Ja* 11.0  10.3 17.1.0
Entfernen von Trigraphs N4086 5 3.5 16.0* Ja 5.0 19.1 11.0 11.0  10.3 17.1.0
Verschachtelte Namespace-Definition N4230 6 3.6 19.0 (Update 3)* Ja 4.12 17.0 17.7 11.0 11.0  10.3 17.1.0
static_assert ohne Meldung  (FTM)* N3928 6 2.5 19.10* Ja 4.12 18.0 17.7 11.0 11.0  10.3 17.1.0
Attribute für Namensräume und Enumeratoren  (FTM)*  (FTM)* N4266 4.9 (teilweise)*
6
3.6 19.0 (2015)* Ja 4.11 17.0 17.7 11.0 11.0  10.3 17.1.0
u8 Zeichenliterale N4267 6 3.6 19.0 (2015)* Ja 4.11 17.0 17.7 11.0 11.0  10.3 17.1.0
Konstante Auswertung für alle konstanten Vorlagenargumente zulassen  (FTM)* N4268 6 3.6 19.12* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
Unäre Faltungsausdrücke und leere Parameterpakete P0036R0 6 3.9 19.12* Ja 4.14 19.0 19.1 11.0 11.0  10.3 17.1.0
Entfernen der veralteten Verwendung des register Schlüsselworts P0001R1 7 3.8 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
Entfernen des veralteten operator++(bool) P0002R1 7 3.8 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
Ausnahmespezifikationen als Teil des Typsystems  (FTM)* P0012R1 7 4 19.12* Ja 4.14 19.0 19.1 11.0 11.0  10.3 17.1.0
__has_include in Präprozessorbedingungen P0061R1 5 Ja 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
DR11: Neue Spezifikation für vererbende Konstruktoren (DR1941 et al)  (FTM)* P0136R1 7 3.9 19.14** Ja 6.1 19.1 11.0 11.0  10.3 17.1.0
Aggregatklassen mit Basisklassen  (FTM)* P0017R1 7 3.9 19.14* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
Faltungsausdrücke (Fold Expressions)  (FTM)* N4295 6 3.6 19.12* Ja 4.14 19.0 18.1 11.0 11.0  10.3 17.1.0
Lambda-Erfassung von *this  (FTM)* P0018R3 7 3.9 19.11* Ja 4.14 19.0 18.1 11.0 11.0  10.3 17.1.0
Direkte Listeninitialisierung von Aufzählungen P0138R2 7 3.9 19.11* Ja 4.14 18.0 19.1 11.0 11.0  10.3 17.1.0
constexpr Lambda-Ausdrücke  (FTM)* P0170R1 7 5 19.11* Ja 4.14 19.0 18.1 11.0 11.0  10.3 17.1.0
Unterschiedliche begin- und end-Typen in bereichsbasierter for-Schleife  (FTM)* P0184R0 6 3.9 19.10* Ja 4.12 18.0 17.7 11.0 11.0  10.3 17.1.0
[[fallthrough]] Attribut P0188R1 7 3.9 19.10* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
[[nodiscard]] Attribut P0189R1 7 3.9 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
[[maybe_unused]] Attribut P0212R1 7 3.9 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
Hexadezimale Gleitkommaliterale  (FTM)* P0245R1 3.0 Ja 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
Attributnamensräume ohne Wiederholung verwenden P0028R4 7 3.9 19.11* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
Dynamische Speicherzuweisung für überausgerichtete Daten  (FTM)* P0035R4 7 4 19.12* 10.0.0* 4.14 19.0 19.1 11.0 11.0  10.3 17.1.0
Konstante Vorlagenparameter mit auto Typ  (FTM)* P0127R2 7 4 19.14* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
Garantierte Kopierelision  (FTM)* P0135R1 7 4 19.13* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
Ersetzung von Klassenobjekten, die Referenzmember enthalten P0137R1 7 6 19.14* Ja 5.0 19.1 11.0 11.0  10.3 17.1.0
Strengere Auswertungsreihenfolge von Ausdrücken P0145R3 7 4 19.14* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
Strukturierte Bindungen  (FTM)* P0217R3 7 4 19.11* Ja 4.14 19.0 18.1 11.0* 11.0  10.3 17.1.0
Unbekannte Attribute ignorieren P0283R2 Ja 3.9 19.0 (2015)* Ja 4.13 18.0 17.7 11.0 11.0  10.3 17.1.0
constexpr if-Anweisungen  (FTM)* P0292R2 7 3.9 19.11* Ja 4.14 19.0 18.1 11.0 11.0  10.3 17.1.0
Init-Anweisungen für if und switch P0305R1 7 3.9 19.11* Ja 4.14 18.0 18.1 11.0 11.0  10.3 17.1.0
Inline-Variablen  (FTM)* P0386R2 7 3.9 19.12* Ja 4.14 19.0 18.1 11.0 11.0  10.3 17.1.0
Entfernen von dynamischen Ausnahmespezifikationen P0003R5 7 4 19.12* Ja 4.14 19.0 19.1 11.0 11.0  10.3 17.1.0
Paketerweiterungen in using-Deklarationen  (FTM)* P0195R2 7 4 19.14* Ja 5.0 19.0 19.1 11.0 11.0  10.3 17.1.0
DR98: Abgleich von Template-Template-Argumenten schließt kompatible Vorlagen aus  (FTM)* P0522R0 7 4 19.12* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
Klassenvorlagen-Argumentableitung  (FTM)* P0091R3 7 5 19.14* Ja 5.0 19.0.1 19.1 11.0 11.0  10.3 17.1.0
 

C++17 Merkmal
 

Papier(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

C++17 Bibliotheksmerkmale

C++17 Merkmal

 
Papier(e)

 
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
 
IBM Open XL C/C++ for AIX*
Intel Parallel STL
Embarcadero C++ Builder*
std::void_t  (FTM)* N3911 6.1 3.6 19.0 (2015)* Ja  17.1.0 N/A 10.3
std::uncaught_exceptions()  (FTM)* N4259 6.1 3.7 19.0 (2015)* Ja  17.1.0 N/A 10.3
std::size(), std::empty() und std::data()  (FTM)* N4280 6 3.6 19.0 (2015)* Ja  17.1.0 N/A 10.3
std::allocator_traits::is_always_equal, noexcept Bereinigungen  (FTM)* N4258 6.1 3.7 19.0 (2015)*   17.1.0 N/A
std::invoke  (FTM)* N4169 6.1 3.7 19.0 (2015)* Ja  17.1.0 N/A
std::map::try_emplace, std::map::insert_or_assign  (FTM)* N4279 6.1 3.7 19.0 (2015)* Ja  17.1.0 N/A
std::unordered_map::try_emplace, std::unordered_map::insert_or_assign  (FTM)* N4279 6.1 3.7 19.0 (2015)* Ja  17.1.0 N/A
Verbesserung von std::pair und std::tuple N4387 6.1 4 19.0 (Update 2)* Ja  17.1.0 N/A 10.3
std::bool_constant  (FTM)* N4389 6.1 3.7 19.0 (2015)* Ja  17.1.0 N/A 10.3
std::shared_mutex (ohne Zeitmessung)  (FTM)* N4508 6 3.7 19.0 (Update 2)* Ja  17.1.0 N/A 10.3
Minimale Unterstützung unvollständiger Typen für std::forward_list, std::list, und std::vector  (FTM)* N4510 3.0 3.6 18.0* Ja  17.1.0 N/A
Typmerkmale (Type Traits) Variablenvorlagen  (FTM)* P0006R0 7.1 3.8 19.0 (Update 2)* Ja  17.1.0 N/A 10.3
Logische Operatoren Typmerkmale  (FTM)* P0013R1 6.1 3.8 19.0 (Update 2)* Ja  17.1.0 N/A 10.3
std::as_const  (FTM)* P0007R1 7.1 3.8 19.0 (Update 2)* Ja  17.1.0 N/A
Rundungsfunktionen für std::chrono::duration und std::chrono::time_point  (FTM)* P0092R1 7.1 3.8 19.0 (Update 2)* Ja  17.1.0 N/A
Transparentes std::owner_less (std::owner_less<void>)  (FTM)* P0074R0 7.1 3.8 19.0 (Update 2)* Ja  17.1.0 N/A
std::not_fn  (FTM)* P0005R4
P0358R1
7.1 3.9 19.12* Ja  17.1.0 N/A 10.3
Parallele Algorithmen und Ausführungsrichtlinien  (FTM)*  (FTM)* P0024R2 9* 17
(teilweise)*
19.14*   18.0*
std::clamp()  (FTM)* P0025R1 7 3.9 19.0 (Update 3)* 10.0.0*  17.1.0 N/A 10.3
(nothrow-)swappable Merkmale  (FTM)* P0185R1 7.1* 3.9 19.0 (Update 3)* 10.0.0*  17.1.0 N/A 10.3
Polymorphe Speicherressourcen  (FTM)* P0220R1 9.1 16 19.13* 15.0.0*  17.1.1 N/A 10.3
std::apply  (FTM)* P0220R1 7.1 16 19.13* Ja  17.1.0 N/A
Sucher (searchers)  (FTM)* P0220R1 7.1 16 19.13* Ja  17.1.0 N/A
std::sample  (FTM)* P0220R1 7.1 16 19.13* Ja  17.1.0 N/A
Mathematische Spezialfunktionen  (FTM)* P0226R1 7 19.14*   17.1.1 N/A 10.3
constexpr std::addressof  (FTM)* LWG2296 7.1 Ja 19.0 (Update 3)*   17.1.0 N/A
constexpr für std::reverse_iterator, std::move_iterator, std::array und Bereichszugriff  (FTM)* P0031R0 7.1 4 19.11* Ja  17.1.0 N/A
constexpr std::atomic<T>::is_always_lock_free  (FTM)* P0152R1 7.1 3.9 19.11* Ja  17.1.0 N/A
std::enable_shared_from_this::weak_from_this  (FTM)* P0033R1 7.1 3.9 19.12* Ja  17.1.0 N/A
3-Argument-Überladung von std::hypot  (FTM)* P0030R1 7.1 3.9 19.14* Ja  17.1.0 N/A
std::byte  (FTM)* P0298R3 7 5 19.11* Ja  17.1.1 N/A 10.3
std::string_view  (FTM)* N3921
P0220R1
P0254R2
P0403R1
7.1 4 19.10* (teilweise)*
19.11**
10.0.0*  17.1.0 N/A 10.3
std::any  (FTM)* P0220R1
P0032R3
7.1 4 19.10* 10.0.0*  17.1.0 N/A 10.3
std::optional  (FTM)* P0220R1 7.1 4 19.10* 10.0.0*  17.1.0 N/A 10.3
Hauptteil der C11-Standardbibliothek P0063R3 9.1 7 19.0 (2015)*
(teilweise)*
10.0.0*  17.1.1 N/A
Spleißen (Splicing) von Maps und Sets  (FTM)* P0083R3 7 8 19.12* 10.0.0*  17.1.1 N/A
Rückgabetyp von emplace* Funktionen einiger Container geändert von void auf Referenz P0084R2 7.1 4.0 19.11* Ja  17.1.0 N/A
std::variant  (FTM)* P0088R3 7.1 4 19.10* 10.0.0*  17.1.0 N/A 10.3
std::make_from_tuple()  (FTM)* P0209R2 7.1 3.9 19.10* Ja  17.1.0 N/A 10.3
std::has_unique_object_representations  (FTM)* P0258R2 7.1 6 19.11* Ja  17.1.1 N/A 10.3
std::gcd() und std::lcm()  (FTM)* P0295R0 7 4 19.11* Ja  17.1.0 N/A 10.3
CWG-Problem 1776: Ersetzung von Klassenobjekten, die Referenzmember enthalten (std::launder)  (FTM)* P0137R1 7.1 6 19.14* Ja  17.1.0 N/A
Erweiterung der Speicherverwaltungswerkzeuge  (FTM)* P0040R3 7.1 4 (teilweise)* 19.11*   17.1.0 N/A
shared_ptr::weak_type  (FTM)* P0163R0 7.1 3.9 19.10* Ja  17.1.0 N/A
Elementare Zeichenkettenkonvertierungen: std::to_chars / std::from_chars  (FTM)* P0067R5 8*
11
7*
14*
20*
19.14**
19.24*
10.0.0**  17.1.1* N/A 10.3*
std::shared_ptr und std::weak_ptr mit Array-Unterstützung P0414R2 7 11 19.12* 12.0.0*  17.1.1 N/A 10.3
Constexpr für alle Memberfunktionen von std::chrono::duration und std::chrono::time_point  (FTM)* P0505R0 7.1 4 19.11* Ja  17.1.1 N/A
std::shared_ptr<T[]>  (FTM)* P0497R0 7.1 11 19.12*   17.1.1 N/A
constexpr std::char_traits  (FTM)* P0426R1 8.1 4 19.14* Ja  17.1.1 N/A
Dateisystembibliothek (std::filesystem)  (FTM)* P0218R1
P0219R1
8 7 19.14* 11.0.0*  17.1.1 N/A 10.3
Hardware-Interferenzgröße  (FTM)* P0154R1 12.1 15 (teilweise)*
19
19.11*   N/A 10.3
std::scoped_lock  (FTM)* P0156R2 7 5 19.11* Ja  17.1.1 N/A 10.3
std::is_aggregate  (FTM)* LWG2911 7 5 19.15* Ja  17.1.1 N/A 10.3
std::is_invocable, std::invoke_result  (FTM)* P0604R0 7.1 Ja 19.11* Ja  17.1.1 N/A
DR17: std::hash<std::filesystem::path> LWG3657 11.4 17 19.32*   N/A
 

C++17 Merkmal
 

Papier(e)
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
 
IBM Open XL C/C++ for AIX*
Intel Parallel STL
Embarcadero C++ Builder*
Anmerkungen
  • Ab 2020-11-20 ist die neueste Version von Oracle Developer Studio 12.6. Dessen Dokumentation erwähnt C++17 nicht.
  • Der Cray-Compiler könnte einige Funktionen früher als 11.0 unterstützen. Diese Version ist, als es zu einem Derivat von Clang wurde und alle entsprechenden Sprachfunktionen des Basis-Compilers erhielt. Siehe Cray/HPE Dokument S-2179.

* - Fahren Sie mit der Maus über eine mit dem Stern * markierte Zelle, um zusätzliche Popup-Notizen anzuzeigen.
DRnn - die Nummer nn nach "DR" bezeichnet die Ziel-C++-Revision, auf die der Fehlerbericht angewendet wird, z.B. DR20 → C++20.

Externe Links

1.  C++17 - Wikipedia
2.  Arbeitsbeispiele für C++17