We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
C++23: An Overview of Almost All New and Updated Features - Marc Gregoire - CppCon 2023
Get an in-depth overview of the new and updated features in C++23, including `std::span`, `std::optional`, `std::variant`, improved error handling, and more, from esteemed speaker Marc Gregoire at CppCon 2023.
- C++23 introduces new and updated features, expanding on what was available in C++20.
-
std::spanallows for easy manipulation of arrays or other containers, andstd::mdspansupports multi-dimensional memory layouts. -
std::optionaladds new methods, includingas_value,as_errorandvalue, andstd::variantis deprecated. -
The
<format>header provides new string formatting APIs, includingstd::formatandstd::formattoa. -
rangelibrary enhancements includeflatten,to,first, andlastalgorithms. -
std::visitallows for flexible and concise expression of visit operation. -
C++23 supports
consteval, which permits evaluation of expressions at compile time if possible. -
std::monostateallows for creation of functions that can’t be instantiated. -
Improvements to error handling, including
unwrapandunwrap_or_defaultforstd::optional. -
Garbage collection APIs are available, including
std::unique_ptr. - Lambda expressions can now explicitly capture by value.
-
Overloadable
std::as_constis added. -
More concise code can be achieved by using
ndenfor lazy evaluation of optional values. - Performance improvements through reduction of unnecessary checking and reallocation.
- Changes to string and character representation, including integer literal suffix and extended character literal syntax.
- Extensions to set and map literals, including initialization with a type.
- Improved support for array and vector views.
-
Enhanced usability of
std::spanandstd::mdspan. -
std::eraseandstd::erase_ifto remove elements from containers. - Many other minor improvements and fixes.
Note: Some of the described features are new in C++20, but also have enhancements in C++23.