New C++23 Standard Released: What Changed and How It Will Affect Development
The International C++ Standardization Committee (ISO/IEC JTC1/SC22/WG21) has officially approved a new version of the language — C++23. This release is not as fundamental as C++11 or C++20, but includes many long-awaited improvements that will make code safer, more expressive, and more performant. Let's break down the key innovations that every C++ developer should know.
Main Changes in C++23
- Deducing this (P0847R7) — the most anticipated innovation. Now you can explicitly specify the object on which a method is called, simplifying overloading for lvalue/rvalue, const and non-const versions, and eliminating code duplication in CRTP templates.
- std::expected (P0323R12) — a type for error handling without exceptions, an alternative to std::optional and exceptions. It allows returning either a value or an error, which is critical for systems with strict performance requirements.
- std modules (P2465R3) — the standard library is now exported via modules, which speeds up compilation and improves code isolation. For example,
import std;replaces dozens of#includedirectives. - Coroutine improvements — the
std::generatortype has been added for lazy sequences, and many performance and ergonomic issues with C++20 coroutines have been fixed. - Multithreading — new
std::latchandstd::barriermechanisms for thread synchronization, as well as an improvedstd::counting_semaphore.
What Does This Mean for Developers?
C++23 does not break backward compatibility, but introduces new practices. For example, deducing this simplifies writing libraries, and std::expected will gradually replace cumbersome return code checks. Many compilers (GCC 13+, Clang 16+, MSVC 2022 17.6+) already support some of the features.
For those working with high-load systems, modules (20-40% build speedup) and improved error handling without exceptions are especially important. If you use C++20, migrating to C++23 will not require rewriting code — just enable the new compilation flag.
When to Expect Full Support?
Full support for C++23 is expected in compilers by the end of 2024. In the meantime, you can test individual features with the -std=c++2b flag (GCC/Clang) or /std:c++latest (MSVC). We recommend starting with std::expected and deducing this — they are the most useful in real-world projects.
Up-to-date code examples and comparisons with C++20 can be found in compiler documentation. C++23 is an evolutionary step that makes the language safer and more convenient without sacrificing performance.