2025-04 Mailing Available

The 2025-04 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
P0260R17 C++ Concurrent Queues Detlef Vollmann 2025-04-15 2025-04 P0260R16 SG1 Concurrency and Parallelism,LWG Library
P1789R1 Library Support for Expansion Statements Alisdair Meredith 2025-04-15 2025-04 P1789R0 LEWG Library Evolution
P2019R8 Thread attributes Corentin Jabot 2025-03-18 2025-04 P2019R7 LWG Library
P2902R1 constexpr 'Parallel' Algorithms Oliver Rosten 2025-04-15 2025-04 P2902R0 LEWG Library Evolution,LWG Library
P2988R12 std::optional<T&> Steve Downey 2025-04-04 2025-04 P2988R11 LWG Library
P2996R11 Reflection for C++26 Barry Revzin 2025-04-16 2025-04 P2996R10 EWG Evolution
P3037R5 constexpr std::shared_ptr and friends Paul Keir 2025-03-27 2025-04 P3037R4 LWG Library
P3096R8 Function Parameter Reflection in Reflection for C++26 Adam Lach 2025-04-14 2025-04 P3096R7 CWG Core,LWG Library
P3126R3 Graph Library: Overview Phil Ratzloff 2025-04-13 2025-04 P3126R2 SG14 Low Latency,SG19 Machine Learning
P3127R1 Graph Library: Background and Terminology Phil Ratzloff 2025-04-13 2025-04 P3127R0 SG14 Low Latency,SG19 Machine Learning
P3128R3 Graph Library: Algorithms Phil Ratzloff 2025-04-13 2025-04 P3128R2 SG14 Low Latency,SG19 Machine Learning
P3129R1 Graph Library: Views Phil Ratzloff 2025-04-13 2025-04 P3129R0 SG14 Low Latency,SG19 Machine Learning
P3130R3 Graph Library: Graph Container Interface Phil Ratzloff 2025-04-13 2025-04 P3130R2 SG14 Low Latency,SG19 Machine Learning
P3131R3 Graph Library: Graph Containers Phil Ratzloff 2025-04-13 2025-04 P3131R2 SG14 Low Latency,SG19 Machine Learning
P3161R4 Unified integer overflow arithmetic Tiago Freire 2025-03-25 2025-04 P3161R3 SG6 Numerics,LEWGI SG18: LEWG Incubator
P3295R3 Freestanding constexpr containers and constexpr exception types Ben Craig 2025-03-25 2025-04 P3295R2 LWG Library
P3312R1 Overload Set Types Bengt Gustafsson 2025-04-16 2025-04 P3312R0 EWGI SG17: EWG Incubator
P3312R1 Overload Set Types Bengt Gustafsson 2025-04-16 2025-04 P3312R0 EWGI SG17: EWG Incubator
P3348R3 C++26 should refer to C23 not C17 Jonathan Wakely 2025-03-21 2025-04 P3348R2 SG6 Numerics,LWG Library
P3371R4 Fix C++26 by making the rank-1, rank-2, rank-k, and rank-2k updates consistent with the BLAS Mark Hoemmen 2025-04-06 2025-04 P3371R3 LWG Library
P3388R2 When Do You Know connect Doesn't Throw? Robert Leahy 2025-04-01 2025-04 P3388R1 LWG Library
P3391R1 constexpr std::format Barry Revzin 2025-04-15 2025-04 P3391R0 LEWG Library Evolution
P3395R3 Fix encoding issues and add a formatter for std::error_code Victor Zverovich 2025-03-22 2025-04 P3395R2 LEWG Library Evolution
P3395R3 Fix encoding issues and add a formatter for std::error_code Victor Zverovich 2025-03-22 2025-04 P3395R2 LEWG Library Evolution
P3481R3 std::execution::bulk() issues Lucian Radu Teodorescu 2025-04-16 2025-04 P3481R2 LWG Library
P3514R0 Implementing "RFC 3514: The Security Flag" for C++ Steve Downey 2025-04-06 2025-04   LEWGI SG18: LEWG Incubator,All of WG21
P3561R2 Index based coproduct operations on variant, and library wording Esa Pulkkinen 2025-04-06 2025-04 P3561R1 LEWGI SG18: LEWG Incubator
P3652R1 Constexpr floating-point <charconv> functions Lénárd Szolnoki 2025-04-16 2025-04 P3652R0 LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P3656R1 Initial draft proposal for core language UB white paper: Process and major work items Herb Sutter 2025-03-25 2025-04 P3656R0 EWG Evolution
P3665R0 Vertical Text Processing Jeremy Rifkin 2025-04-01 2025-04   EWG Evolution
P3667R0 Extending range-for loop with an expression statement Jose Daniel Garcia 2025-04-10 2025-04   EWGI SG17: EWG Incubator
P3668R0 Defaulting Postfix Increment and Decrement Operations Matthew Taylor 2025-04-15 2025-04   EWGI SG17: EWG Incubator
P3669R0 Non-Blocking Support for `std::execution` Detlef Vollmann 2025-04-15 2025-04   SG1 Concurrency and Parallelism,LEWG Library Evolution
P3670R0 Pack Indexing for Template Names Corentin Jabot 2025-04-16 2025-04   EWG Evolution
P3671R0 Clarifying the interaction of the literal and execution encodings Corentin Jabot 2025-04-16 2025-04   SG16 Unicode
P3672R0 On Windows, Systems APIs, Text Encodings, and Pragmatism Corentin Jabot 2025-04-16 2025-04   SG16 Unicode

Creating a Generic Insertion Iterator, Part 2 -- Raymond Chen

RaymondChen_5in-150x150.jpgLast time, our generic insertion iterator failed to meet the requirements of default constructibility and assignability because it stored the lambda directly. To fix this, we now store a pointer to the lambda instead, ensuring the iterator meets standard requirements while still allowing flexible insertion logic.

Creating a Generic Insertion Iterator, Part 2

by Raymond Chen

From the article:

Last time, we tried to create a generic insertion iterator but ran into trouble because our iterator failed to satisfy the iterator requirements of default constructibility and assignability.

We ran into this problem because we stored the lambda as a member of the iterator.

So let’s not do that!

Instead of saving the lambda, we’ll just save a pointer to the lambda.

template<typename Lambda>
struct generic_output_iterator
{
    using iterator_category = std::output_iterator_tag;
    using value_type = void;
    using pointer = void;
    using reference = void;
    using difference_type = void;

    generic_output_iterator(Lambda&& lambda) noexcept :
        insert(std::addressof(lambda)) {}

    generic_output_iterator& operator*() noexcept
        { return *this; }
    generic_output_iterator& operator++() noexcept
        { return *this; }
    generic_output_iterator& operator++(int) noexcept
        { return *this; }

    template<typename Value>
    generic_output_iterator& operator=(
        Value&& value)
    {
        (*insert)(std::forward<Value>(value));
        return *this;
    }

protected:
    Lambda* insert;

};

template<typename Lambda>
generic_output_iterator<Lambda>
generic_output_inserter(Lambda&& lambda) noexcept {
    return generic_output_iterator<Lambda>(
        std::forward<Lambda>(lambda));
}

template<typename Lambda>
generic_output_iterator(Lambda&&) ->
    generic_output_iterator<Lambda>;

This requires that the lambda remain valid for the lifetime of the iterator, but that may not a significant burden. Other iterators also retain references that are expected to remain valid for the lifetime of the iterator. For example, std::back_inserter(v) requires that v remain valid for as long as you use the inserter. And if you use the iterator immediately, then the requirement will be satisfied:

Looking for Employers for the Meeting C++ Job Fair and the C++ Jobs Newsletter

Meeting C++ is looking for C++ Employers, as it starts a C++ Jobs Newsletter and hosts an online C++ Job fair in May!

Looking for Employers for the C++ Job Fair and the C++ Jobs Newsletter

by Jens Weller

From the article:

Meeting C++ launches a new jobs newsletter! Share your open positions!

The jobs newsletter already has 1500+ subscribers and aims at a bi-weekly schedule, with sometimes being weekly when lots of jobs are submitted. Once a month Meeting C++ will also send the jobs newsletter on its main newsletter with 25k+ subscribers in 2025. So your open positions will be seen by lots of experienced developers.

 

Creating a Generic Insertion Iterator, Part 1 -- Raymond Chen

RaymondChen_5in-150x150.jpgIn our previous post, we created an inserter iterator for unhinted insertion, and now we’re taking it a step further by generalizing it into a boilerplate-only version. This generic output iterator allows for custom insertion logic using a lambda, but as we’ll see, it doesn’t fully satisfy iterator requirements—something we’ll attempt to fix next time.

Creating a Generic Insertion Iterator, Part 1

by Raymond Chen

From the article:

Last time, we created an inserter iterator that does unhinted insertion. We noticed that most of the iterator is just boilerplate, so let’s generalize it into a version that is all-boilerplate.

// Do not use: See discussion
template<typename Lambda>
struct generic_output_iterator
{
    using iterator_category = std::output_iterator_tag;
    using value_type = void;
    using pointer = void;
    using reference = void;
    using difference_type = void;

    generic_output_iterator(Lambda&& lambda) :
        insert(std::forward<Lambda>(lambda)) {}

    generic_output_iterator& operator*() noexcept
        { return *this; }
    generic_output_iterator& operator++() noexcept
        { return *this; }
    generic_output_iterator& operator++(int) noexcept
        { return *this; }

    template<typename Value>
    generic_output_iterator& operator=(
        Value&& value)
    {
        insert(std::forward<Value>(value));
        return *this;
    }

protected:
    std::decay_t<Lambda> insert;

};

template<typename Lambda>
generic_output_iterator<Lambda>
generic_output_inserter(Lambda&& lambda) {
    return generic_output_iterator<Lambda>(
        std::forward<Lambda>(lambda));
}

template<typename Lambda>
generic_output_iterator(Lambda&&) ->
    generic_output_iterator<Lambda>;

For convenience, I provided both a deduction guide and a maker function, so you can use whichever version appeals to you. (The C++ standard library has a lot of maker functions because they predate class template argument deduction (CTAD) and deduction guides.)

Using Senders/Receivers -- Lucian Radu Teodorescu

1.pngC++26 will introduce senders/receivers. Lucian Radu Teodorescu demonstrates how to use them to write multithreaded code.

Using Senders/Receivers

by Lucian Radu Teodorescu

From the article:

This is a follow-up to the article in the previous issue of Overload, which introduced the upcoming C++26 senders/receivers framework [WG21Exec]. While the previous article focused on presenting the main concepts and outlining what will be standardized, this article demonstrates how to use the framework to build concurrent applications.

The goal is to showcase examples that are closer to real-world software rather than minimal examples. We address three problems that can benefit from multi-threaded execution: computing the Mandelbrot fractal, performing a concurrent sort, and applying a graphical transformation to a set of images.

All the code examples are available on GitHub [ExamplesCode]. We use stdexec [stdexec], the reference implementation for the senders/receivers proposal. Additionally, some features included in the examples are not yet accepted by the standard committee, though we hope they will be soon.

How do I create an inserter iterator for unhinted insertion into std::map? -- Raymond Chen

RaymondChen_5in-150x150.jpgThe C++ standard library provides various inserters like back_inserter, front_inserter, and inserter, but for associative containers like std::map, only inserter is available, requiring a hint. However, if elements arrive in an unpredictable order, providing a hint could be inefficient, so a custom inserter that performs unhinted insertion can be a useful alternative.

How do I create an inserter iterator that does unhinted insertion into an associative container like std::map

by Raymond Chen

From the article:

The C++ standard library contains various types of inserters:

  • back_inserter(c) which uses c.push_back(v).
  • front_inserter(c) which uses c.push_front(v).
  • inserter(c, it) which uses c.insert(it, v).

C++ standard library associative containers do not have push_back or push_front methods; your only option is to use the inserter. But we also learned that the hinted insertion can speed up the operation if the hint is correct, or slow it down if the hint is wrong. (Or it might not have any effect at all.)

What if you know that the items are arriving in an unpredictable order? You don’t want to provide a hint, because that’s a pessimization. The inserter requires you to pass a hint. What do you do if you don’t want to provide a hint?

C++26: Erroneous Behaviour -- Sandor Dargo

SANDOR_DARGO_ROUND.JPGWith C++26, the introduction of erroneous behavior provides a well-defined alternative to undefined behavior when reading uninitialized values, making it easier to diagnose and fix potential bugs. This blog post explores the impact of P2795R5, how compilers will handle erroneous values, and the new [[indeterminate]] attribute for cases where deliberate uninitialized values are needed.

C++26: Erroneous Behaviour

by Sandor Dargo

From the article:

If you pick a random talk at a C++ conference these days, there is a fair chance that the speaker will mention safety at least a couple of times. It’s probably fine like that. The committee and the community must think about improving both the safety situation and the reputation of C++.

If you follow what’s going on in this space, you are probably aware that people have different perspectives on safety. I think almost everybody finds it important, but they would solve the problem in their own way.

A big source of issues is certain manifestations of undefined behaviour. It affects both the safety and the stability of software. I remember that a few years ago when I was working on some services which had to support a 10x growth, one of the important points was to eliminate undefined behaviour as much as possible. One main point for us was to remove uninitialized variables which often lead to crashing services.

Thanks to P2795R5 by Thomas Köppe, uninitialized reads won’t be undefined behaviour anymore - starting from C++26. Instead, they will get a new behaviour called “erroneous behaviour”.

The great advantage of erroneous behaviour is that it will work just by recompiling existing code. It will diagnose where you forgot to initialize variables. You don’t have to systematically go through your code and let’s say declare everything as auto to make sure that every variable has an initialized value. Which you probably wouldn’t do anyway.

But what is this new behaviour that on C++ Reference is even listed on the page of undefined behaviour? It’s well-defined, yet incorrect behaviour that compilers are recommended to diagnose. Is recommended enough?! Well, with the growing focus on safety, you can rest assured that an implementation that wouldn’t diagnose erroneous behaviour would be soon out of the game.

Contracts for C++ Explained in 5 Minutes -- Timur Doumler

CRussia2019_portrait-1-1024x683.jpgContract assertions, introduced in proposal P2900 for C++26, provide a robust mechanism for runtime correctness checks, offering more flexibility and power than the traditional assert macro. This blog post will explore how contract assertions work, their various evaluation semantics, and how they can improve code reliability with preconditions, postconditions, and custom violation handlers.

Contracts for C++ Explained in 5 Minutes

by Timur Doumler

From the article:

With P2900, we propose to add contract assertions to the C++ language. This proposal is in the final stages of wording review before being included in the draft Standard for C++26.

It has been suggested by some members of the C++ standard committee that this feature is too large, too complicated, and hard to teach. As it turns out, the opposite is true: contract assertions are actually very simple and can be explained in just five minutes. In this blog post, we will do exactly this!

As the name says, contract assertions are assertions — correctness checks that the programmer can add to their code to detect bugs at runtime. So they’re just like the existing assert macro, except they’re not macros (which fixes a bunch of problems) and they’re way more flexible and powerful!


contract_assert replaces assert

Our replacement for assert is called contract_assert. Unlike assertcontract_assert is a proper keyword, but it works in the same way:
 
auto w = getWidget(); 
contract_assert(w.isValid());  // a contract assertion
processWidget(w);
 
The default behaviour is also the same: the assertion is checked, and if the check fails, the program prints a diagnostic message and terminates.