C++26: Removed and Deprecated Features Roundup

2025-03-20

C++26 is removing or deprecating several features. These include the complete removal of the `std::allocator` typedef deprecated in C++20, and the no-argument overload of `std::basic_string::reserve()`; removal of deprecated Unicode conversion utilities and `std::strtok`; removal of aged `strstreams` and `std::shared_ptr` atomic access APIs; and removal of `std::wstring_convert`. Additionally, `std::is_trivial` is deprecated, with suggestions to use the more precise `is_trivially_XXX` alternatives; and `std::memory_order::consume` is deprecated due to unsatisfactory specification and implementation difficulties. These removals and deprecations aim to improve language safety and efficiency, and clean up outdated functionality.

Read more

C++26: Pack Indexing Simplifies Element Extraction

2025-01-24

While C++11 introduced parameter packs, extracting specific elements remained cumbersome. C++26, thanks to proposal P2662R3, introduces pack indexing, allowing direct access to pack elements using the subscript operator, e.g., `T...[0]` for the first element. This leads to cleaner, more readable code and improved compile-time performance. Although negative indexing and slicing aren't yet supported, the feature is already highly usable, significantly improving C++ development.

Read more

C++26: The Unnamed Placeholder `_` Arrives

2025-01-11

C++26 introduces a game-changing feature: the unnamed placeholder `_`. This solves a long-standing annoyance in C++: handling unused variables. Previously, developers needed `[[maybe_unused]]` or `std::ignore` to avoid compiler warnings, especially with structured bindings. The `_` placeholder can be declared multiple times without conflict and implicitly has the `[[maybe_unused]]` attribute, simplifying code and improving readability. This feature is already implemented in GCC 14 and Clang 18.

Read more