The Latest Standard (C++23)¶
C++23 refines the revolution started by C++20, filling in gaps and adding powerful new library features.
std::print and std::println¶
Finally, a modern way to print to the console! It combines the performance of printf with the safety and ease of std::format.
std::expected (Error Handling)¶
std::expected<T, E> represents either a value of type T (success) or an error of type E (failure). It is cleaner than exceptions for expected errors.
Deducing this (Explicit Object Parameter)¶
Allows you to deduce the value category (lvalue/rvalue) and const-ness of the object (this) in a member function. Useful for CRTP and deduplicating code.
if consteval¶
A safer version of if (std::is_constant_evaluated()). It executes the block only during compile-time evaluation.
Multidimensional Arrays (std::mdspan)¶
A non-owning, multidimensional view of contiguous data. Great for scientific computing and image processing.
Standard Library Modules (import std;)¶
C++23 standardizes the std module, allowing you to import the entire standard library at once with minimal compile-time cost.
Other Features¶
std::unreachable(): Marks code as unreachable (optimization hint).std::to_underlying(): Casts an enum to its underlying integer type.std::byteswap(): Reverses endianness.