C++26#Library
{{Short description|Computer programming language}}
{{Update|date=May 2024}}
{{C++ language revisions}}
C++26 is the informal name for the version of the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC) 14882 standard for the C++ programming language that follows C++23. The current working draft of this version is N5008.{{Cite web|title=Working Draft, Standard for Programming Language C++|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/n5008.pdf|date=2025-03-15 |publisher=ISO/IEC |website=Open Standards }}
Features
Changes that have been accepted into C++26 include:
= Language =
- Unevaluated strings.
- Adding
@
,$
, and`
to the basic character set. constexpr
cast fromvoid*
.- User-generated
static_assert
messages. - Placeholder variables with no name.
- Pack indexing.
- Attributes for structured bindings.
- Erroneous behavior for uninitialized reads.
= delete("reason");
- Variadic friends.
constexpr
placementnew
.- Structured binding declaration as a condition.
- Ordering of constraints involving fold expressions.
- Deleting a pointer to an incomplete type should be ill-formed.
- Structured bindings can introduce a pack.
- Allowing exception throwing in constant-evaluation.
constexpr
structured bindings and references toconstexpr
variables.- Oxford variadic comma, i.e. "Deprecate ellipsis parameters without a preceding comma. The syntax
(int...)
is incompatible with C, detrimental to C++, and easily replaceable with(int, ...)
."{{Cite web |title=P3176R1: The Oxford variadic comma |url=https://eisenwave.github.io/cpp-proposals/oxford-variadic-comma.html |access-date=2024-12-09 |website=eisenwave.github.io}} - Removing deprecated array comparisons.
- Contracts{{Cite web |title=Contract assertions (since C++26) - cppreference.com |url=https://en.cppreference.com/w/cpp/language/contracts |access-date=2025-03-09 |website=en.cppreference.com}}
= Library =
- Hashing support for
std::chrono
value classes std::is_within_lifetime
- Native handles in file streams
- Interfacing string streams with
std::string_view
- Interfacing
std::bitset
withstd::string_view
- More
constexpr
for
and - Adding the new 2022 SI prefixes on ratios:
std::quecto
,std::ronto
,std::ronna
, andstd::quetta
std::copyable_function
std::submdspan()
: Debugging Support
: A free function linear algebra interface based on the BLAS- Added tuple protocol to
std::complex
views::concat
- Concatenation of strings and string views
std::ranges::generate_random
- Printing blank lines with
std::println()
std::formatter
- Saturation arithmetic with, among others,
std::add_sat
,std::div_sat
External links
- [https://en.cppreference.com/w/cpp/compiler_support/26 Compiler support for C++26 features]