
What are the new features in C 17?
C 17 introduces a range of new features and improvements to the language, including:
Language Features:
- Template Argumentabzug für Klassenvorlagen
- Vorlage , um Werte eines Nicht-Typ-Arguments zu repräsentieren. Integer
- Modernisierung mit ... und listet
- constExpr lambdas
- dies in lambdas
- Attributen wie [Falhrough]], [[nodiscard]], [vielleicht] [vielleicht] [vielleicht] [und]
Attribute und Attribute und Attribute und Attribusen und Attributen und Attributen und Attribusen und Attributen und Attribusen und Attributen] und Attribute und Attribusen und Attributen und Attributen und Attributen und Attributen und Attraktionen aufnehmen, und möglicherweise achten. Enumerators -
Verwenden in Attributen, um zu vermeiden, dass Attribut-Namenspaces -
verpflichtet werden, Nicht-Standard-Attribute zu ignorieren. static_assert (Ausdruck); Ohne String -
eliminieren und ersetzen Sie es durch Throw () und noexcept (true) -
-
-
Cleaner Multi-Return und Flow Control: -
. (Init; Bedingung) und Switch (init; Bedingung) für erweiterte if und Switch-Anweisungen -
verallgemeinern Bereiche für Schleifen für Sentinels und benutzerdefinierte Iteratoren -
if consexpr für fast generisch code
Misc:Hexadecimal float point literals
Dynamic memory allocation for over-aligned data- Guaranteed copy elision
- Fixed order-of-evaluation for Expressions
-
Direktlisteinitialisierung von Enums -
Fortschritts-Garantien (fpgs)
Charakter Literale u8'u ', u8't', u8'f ', u8'8' -
im Type, in dem Typ-System
-
-
-
-
__ haben __ haben. errors- Arrays of pointer conversion fixes
- Fixes to inherited constructors and aggregate initialization with inheritance
- Utility functions for std type punning
- Library Additions:
Data types:std::variant for tagged union types
std::optional for nullable valuesstd::any for any type of value std :: string_view als Referenz auf ein Zeichen -Array oder Substring
std :: byte als weder eine Ganzzahl noch ein Zeichen, aber nur data -
-
-
Invoke stuff:- std::invoke for generic function calling
std::apply for unpacking tuples into function callsstd::make_from_tuple and std::apply for object constructionis_invocable, is_invocable_r, and invoke_result for function invocation functionality
- File System TS v1
: Improved file system operations- New algorithms:
for_each_n, reduce, transform_reduce, exclusive_scan, inclusive_scan, transform_exclusive_scan, and transform_inclusive_scan
- Threading: std::shared_mutex, atomic::is_always_lockfree, and scoped_lock
- Parallelism TS v1: Parallel versions of algorithms and related machinery
- Library Fundamentals TS v1: Searching algorithms, polymorphic allocator (pmr), sampling
- Container Improvements: try_emplace and insert_or_assign, splicing for maps and sets, non-const .data() for strings, non-member std::size, std::empty, std::data, minimal incomplete type support in containers, contiguous iterator "concept", constexpr iterators, updated constructors for emplace family of functions
- Smart pointer changes: Fixes to unique_ptr and tweaks to weak_from_this and shared from this
- Other std datatype improvements: Construction of std::tuple with curly braces, trivially copyable reference_wrapper
- Misc:
- C 17 library is based on C11 instead of C99
reserviert std [0-9] für zukünftige Standardbibliotheken -
Dienstprogrammfunktionen wie Destroy, Uninitialized_Move, nicht initialisiert_value_construct und nicht initialisiert_default_construct Special Mathe Mathematik. Funktionen
std :: clamp () -
gcd und lcm rechnen -
std :: uncaught_exceptions für das Werfen in Destruktoren -
std :: as_const und std :: bool_constant Typen -
std :: void_t und std :: void_t Typen -
std :: inbinding_less Damit Smart -Zeiger basierend auf Inhalten sortieren können -
Verbesserungen an Std :: chrono -
-
-
-
-
- std: std :: negation
- std :: not_fn
- Regeln für noexcept in std
- std :: is_contiguous_layout
- Hochleistungsnummer mit Std :: to_chars und to_chars und std::from_chars
Traits:
- swap, is_aggregate, has_unique_object_representations