C++29
Revision of the C++ programming language planned for 2029
C++29 is the informal name for the open standard revision of the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC) 14882 standard for the C++ programming language that follows C++26, planned for release in 2029.
The first meeting took place in June 2026 in Brno, Czech Republic.
No compiler fully supports C++29, and it is not yet finalized, but GCC has the most supported features of it so far.
Features
Language
- An
offsetparameter for the#embeddirective - Support for contracts on virtual functions
- Pack indexing for variadic templates
- Designated initializers for constructing a base struct
- Deallocation functions with a throwing specification (i.e.
void operator delete(void* p) noexcept(false);are ill-formed) - Conditional
noexceptspecifiers in concept compound requirements - Support for
= default;assignments for postfix increment/decrement operators (i.e.T operator++(T&, int) = default; - Additional restrictions on defaulted assignment operator functions
consteval-only values:- A value is consteval-only if it is either a reflection value or a pointer or pointer-to-member that points to either an immediate object or an immediate function.
- An object is immediate if its complete object has either a constituent value that is consteval-only, or a constituent reference that refers to either an immediate object or an immediate function.
- A variable is immediate if the object it declares is an immediate object.
- Additional named universal character escapes
- Coroutine promise return functions (
return_void(),return_value()) are no longer mutually exclusive; this allows coroutines to return in different execution pathsco_return;andco_return x;. - Adopt the recommendations of Section 3.1 of Unicode Technical Standard #55, Unicode Source Handling, allowing identifiers to be composed from additional Unicode characters
- Specify captures of a lambda to be declared in the order of appearance
- Allow language linkage for templates; these may not necessarily work due to implementation-specific language linking rules, but the standard now allows it.
- Clarification of floating-point overflow
- Nondeterministic pointer provenance, where reconstructing a pointer from an integer or raw bytes automatically selects whatever matching pointer value gives the program defined behaviour
- Atomic operations and operations on
volatilepointers are defined to yield and store prospective pointer values - Defined load and store operations for invalid pointers
- Labelled
breakandcontinuestatements (following their adoption in C29, and using the same syntax as Java). See multi-level breaks.
Library
- Adding a
lookup()method to map typesstd::map<K, V>,std::unordered_map<K, V>andstd::flat_map<K, V>which returns astd::optional<V&> - A tagged pointer class
std::pointer_tag_pair<Ptr, Tag, N>withconstexprsupport, in<memory> name_hint<T>andstack_size_hintforstd::threadandstd::jthread, which allows setting a thread stack size and a thread namevoid make_hazard_pointer_batch(span<hazard_pointer> batch);andvoid clear_hazard_pointer_batch(span<hazard_pointer> batch);for handling creation/destruction of hazard pointer batches- Bit permutation functions, SIMD bit permutation, and bit shifting
copy()andfill()algorithms forstd::mdspan- A
std::simd::iotatype has_error()method forstd::expected<T, E>at()accessor forstd::ranges::view_interface<D>std::formatter<>specialization forstd::error_code- Change default floating-point representation in
std::format()to be in standard form intptr_tanduintptr_tare now required to be implemented- Signed character types are deprecated from use in iostreams
- Revert string support in
std::constant_wrapper<T> - A type-erased view,
std::ranges::any_view<T>, allowing customised traversal category and value type specification. - A
std::views::sliceview adaptor for extracting a contiguous subrange from a sequence given a start and end index - A
get_ptr()method forstd::optionalto retrieve its stored pointer. Of particular interest foroptional<T&>.
Anticipated/discussed additions
Among some of the discussed features include Herb Sutter's "metaclasses" proposal (of which a similar feature already exists in his experimental alternative "Cpp2" syntax), which propose adoptable vocabulary for class boilerplate generation; to facilitate this, code injection for reflection would add token sequence injection into source code. This was later expanded with direct token sequence injection and token sequence macros, similar to syntactic macros, which already exist in languages like Rust.
Of particular interest were adding a more robust way of addressing undefined behavior. A proposal which enumerated all cases of undefined behavior specified in the C++ standard further proposed implicit contract assertions against undefined behavior, as well as unconstrained behavior (which takes the old definition of undefined behavior), as well as "profiles", which allow opt-in disabling unsafe behavior.
Pattern matching, a long-desired and anticipated feature for C++, has an ongoing proposal for C++29; rather than reusing switch, it uses a new match keyword, and also introduces match expressions (similar to Java and C#'s switch expressions). The proposal additionally depends on another feature, do expressions (a sequence of statements that is itself an expression), and is itself similar to a lambda with [&] capture that is immediately invoked. It uses a new keyword, do_return, to return the expression's value.
Adapted from the Wikipedia article, CC BY-SA 4.0. Continue on Wikipedia
Go deeper
Ideas this article links to.