July 2024

2024-07 Mailing Available

The 2024-07 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
N4984 WG21 June 2024 Admin Minutes of Meeting Nina Ranns 2024-06-17 2024-07   All of WG21
N4985 WG21 2024-06 St Louis Minutes of Meeting Nina Ranns 2024-07-11 2024-07   All of WG21
N4986 Working Draft, Programming Languages -- C++ Thomas Köppe 2024-07-16 2024-07   All of WG21
N4987 Editors' Report, Programming Languages -- C++ Thomas Köppe 2024-07-16 2024-07   All of WG21
P0260R10 C++ Concurrent Queues Detlef Vollmann 2024-06-27 2024-07 P0260R9 LEWG Library Evolution
P0472R1 Put std::monostate in <utility> David Sankel 2024-06-05 2024-07 P0472R0 LEWG Library Evolution
P0843R13 inplace_vector Gonzalo Brito Gadeschi 2024-06-17 2024-07 P0843R12 LEWG Library Evolution,LWG Library
P0843R14 inplace_vector Gonzalo Brito Gadeschi 2024-06-26 2024-07 P0843R13 LWG Library
P0876R17 fiber_context - fibers without scheduler Oliver Kowalke 2024-07-03 2024-07 P0876R16 EWG Evolution,CWG Core,LWG Library
P0963R3 Structured binding declaration as a condition Zhihao Yuan 2024-06-28 2024-07 P0963R2 CWG Core
P1928R10 std::simd - Merge data-parallel types from the Parallelism TS 2 Matthias Kretz 2024-06-28 2024-07 P1928R9 LWG Library
P1928R11 std::simd - Merge data-parallel types from the Parallelism TS 2 Matthias Kretz 2024-07-16 2024-07 P1928R10 LWG Library
P2075R6 Philox as an extension of the C++ RNG engines Ilya Burylov 2024-06-28 2024-07 P2075R5 LWG Library
P2300R10 `std::execution` Eric Niebler 2024-06-28 2024-07 P2300R9 LEWG Library Evolution,LWG Library
P2319R0 Prevent path presentation problems Victor Zverovich 2024-07-06 2024-07   SG16 Unicode
P2389R2 `dextents` Index Type Parameter Bryce Adelstein Lelbach 2024-06-24 2024-07 P2389R1 LEWG Library Evolution
P2422R1 Remove nodiscard annotations from the standard library specification Ville Voutilainen 2024-06-28 2024-07 P2422R0 LEWG Library Evolution,LWG Library
P2642R6 Padded mdspan layouts Christian Trott 2024-06-18 2024-07 P2642R5 LEWG Library Evolution,LWG Library
P2656R3 C++ Ecosystem International Standard René Ferdinand Rivera Morell 2024-07-11 2024-07 P2656R2 EWG Evolution,LEWG Library Evolution
P2664R7 Proposal to extend std::simd with permutation API Daniel Towner 2024-06-25 2024-07 P2664R6 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2686R4 constexpr structured bindings and references to constexpr variables Corentin Jabot 2024-07-05 2024-07 P2686R3 EWG Evolution,LEWG Library Evolution,CWG Core
P2761R2 Slides: Evaluating structured binding as a condition (P0963R2 presentation) Zhihao Yuan 2024-06-13 2024-07 P2761R1 EWG Evolution
P2761R3 Slides: Structured binding declaration as a condition (P0963R2 presentation) Zhihao Yuan 2024-06-26 2024-07 P2761R2 EWG Evolution
P2769R2 get_element customization point object Ruslan Arutyunyan 2024-06-25 2024-07 P2769R1 SG9 Ranges,LEWG Library Evolution
P2848R1 std::is_uniqued Arthur O'Dwyer 2024-07-14 2024-07 P2848R0 LEWG Library Evolution
P2863R6 Review Annex D for C++26 Alisdair Meredith 2024-06-23 2024-07 P2863R5 EWG Evolution,LEWG Library Evolution
P2863R7 Review Annex D for C++26 Alisdair Meredith 2024-07-09 2024-07 P2863R6 SG22 Compatibility,EWG Evolution,LEWG Library Evolution
P2865R5 Remove Deprecated Array Comparisons from C++26 Alisdair Meredith 2024-07-09 2024-07 P2865R4 SG22 Compatibility
P2866R3 Remove Deprecated Volatile Features From C++26 Alisdair Meredith 2024-06-28 2024-07 P2866R2 CWG Core,LWG Library
P2866R4 Remove Deprecated Volatile Features From C++26 Alisdair Meredith 2024-07-15 2024-07 P2866R3 SG22 Compatibility,CWG Core,LWG Library
P2873R2 Remove Deprecated locale category facets for Unicode from C++26 Alisdair Meredith 2024-07-06 2024-07 P2873R1 LEWG Library Evolution
P2897R2 aligned_accessor: An mdspan accessor expressing pointer overalignment Mark Hoemmen 2024-07-12 2024-07 P2897R1 LEWG Library Evolution
P2897R3 aligned_accessor: An mdspan accessor expressing pointer overalignment Mark Hoemmen 2024-07-15 2024-07 P2897R2 LEWG Library Evolution,LWG Library
P2963R3 Ordering of constraints involving fold expressions Corentin Jabot 2024-06-28 2024-07 P2963R2 CWG Core
P2989R2 A Simple Approach to Universal Template Parameters Corentin Jabot 2024-06-16 2024-07 P2989R1 EWG Evolution
P2996R4 Reflection for C++26 Barry Revzin 2024-06-26 2024-07 P2996R3 EWG Evolution
P3006R1 Launder less Antony Polukhin 2024-07-11 2024-07 P3006R0 SG12 Undefined and Unspecified Behavior,EWG Evolution,CWG Core
P3037R2 constexpr std::shared_ptr Paul Keir 2024-05-24 2024-07 P3037R1 LEWG Library Evolution
P3044R1 sub-string_view from string Michael Florian Hava 2024-07-15 2024-07 P3044R0 LEWG Library Evolution
P3051R2 Structured Response Files René Ferdinand Rivera Morell 2024-07-11 2024-07 P3051R1 EWG Evolution,LEWG Library Evolution
P3064R2 How to Avoid OOTA Without Really Trying Paul E. McKenney 2024-07-12 2024-07 P3064R1 SG1 Concurrency and Parallelism
P3068R3 Allowing exception throwing in constant-evaluation Hana Dusíková 2024-06-27 2024-07 P3068R2 EWG Evolution,LEWG Library Evolution
P3085R3 `noexcept` policy for SD-9 (throws nothing) Ben Craig 2024-07-04 2024-07 P3085R2 LEWG Library Evolution
P3087R1 Make direct-initialization for enumeration types at least as permissive as direct-list-initializatio Jan Schultke 2024-05-29 2024-07 P3087R0 EWG Evolution
P3094R3 std::basic_fixed_string Mateusz Pusz 2024-06-30 2024-07 P3094R2 SG16 Unicode,LEWG Library Evolution
P3096R2 Function Parameter Reflection in Reflection for C++26 Adam Lach 2024-07-16 2024-07 P3096R1 EWG Evolution,LEWG Library Evolution
P3124R0 2024-02 Library Evolution Poll Outcomes   2024-06-14 2024-07   LEWG Library Evolution
P3137R2 views::to_input Tim Song 2024-07-16 2024-07 P3137R1 LEWG Library Evolution
P3138R2 views::cache_last Tim Song 2024-07-16 2024-07 P3138R1 LEWG Library Evolution
P3144R1 Deprecate Delete of Incomplete Class Type Alisdair Meredith 2024-05-23 2024-07 P3144R0 CWG Core
P3144R2 Deleting a Pointer to an Incomplete Type Should be Ill-formed Alisdair Meredith 2024-06-25 2024-07 P3144R1 CWG Core
P3149R4 async_scope -- Creating scopes for non-sequential concurrency Ian Petersen 2024-06-23 2024-07 P3149R3 SG1 Concurrency and Parallelism,LEWG Library Evolution
P3149R5 async_scope -- Creating scopes for non-sequential concurrency Ian Petersen 2024-06-25 2024-07 P3149R4 LEWG Library Evolution
P3161R2 Unified integer overflow arithmetic Tiago Freire 2024-07-15 2024-07 P3161R1 SG6 Numerics
P3164R1 Improving diagnostics for sender expressions Eric Niebler 2024-06-15 2024-07 P3164R0 LEWG Library Evolution
P3164R2 Improving diagnostics for sender expressions Eric Niebler 2024-06-24 2024-07 P3164R1 LEWG Library Evolution
P3168R2 Give std::optional Range Support David Sankel 2024-06-25 2024-07 P3168R1 LEWG Library Evolution
P3175R3 Reconsidering the `std::execution::on` algorithm Eric Niebler 2024-06-24 2024-07 P3175R2 LEWG Library Evolution
P3178R0 Retrieval of Exception Information TPK Healy 2024-05-23 2024-07   LEWGI SG18: LEWG Incubator
P3178R1 Retrieval of Exception Information TPK Healy 2024-05-30 2024-07 P3178R0 LEWGI SG18: LEWG Incubator
P3179R2 C++ parallel range algorithms Ruslan Arutyunyan 2024-06-25 2024-07 P3179R1 SG1 Concurrency and Parallelism,SG9 Ranges
P3182R1 Add container pop methods that return the popped value Brian Bi 2024-07-16 2024-07 P3182R0 LEWG Library Evolution
P3212R0 The contract of sort() Andrzej Krzemieński 2024-07-03 2024-07   SG21 Contracts,EWG Evolution,LEWG Library Evolution
P3223R1 Making std::istream::ignore less surprising Jonathan Wakely 2024-07-03 2024-07 P3223R0 LEWG Library Evolution
P3235R1 std::print more types faster with less memory Victor Zverovich 2024-06-15 2024-07 P3235R0 LEWG Library Evolution
P3235R2 std::print more types faster with less memory Victor Zverovich 2024-06-25 2024-07 P3235R1 LWG Library
P3235R3 std::print more types faster with less memory Victor Zverovich 2024-06-26 2024-07 P3235R2 LWG Library
P3245R1 Allow `[[nodiscard]]` in type alias declarations Xavier Bonaventura 2024-07-15 2024-07 P3245R0 EWGI SG17: EWG Incubator
P3248R1 Require [u]intptr_t Gonzalo Brito Gadeschi 2024-06-16 2024-07 P3248R0 SG1 Concurrency and Parallelism,SG22 Compatibility,EWG Evolution,LEWG Library Evolution
P3255R1 Expose whether atomic notifying operations are lock-free Brian Bi 2024-07-16 2024-07 P3255R0 LEWG Library Evolution
P3265R2 Ship Contracts in a TS Ville Voutilainen 2024-05-27 2024-07 P3265R1 EWG Evolution
P3265R3 Ship Contracts in a TS Ville Voutilainen 2024-05-28 2024-07 P3265R2 EWG Evolution
P3288R1 std::elide Thomas P. K. Healy 2024-05-28 2024-07 P3288R0 EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P3288R2 std::elide Thomas P. K. Healy 2024-05-29 2024-07 P3288R1 EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P3288R3 std::elide Thomas P. K. Healy 2024-06-27 2024-07 P3288R2 EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P3290R1 Integrating Existing Assertions With Contracts Joshua Berne 2024-07-12 2024-07 P3290R0 SG21 Contracts,EWG Evolution
P3294R1 Code Injection with Token Sequences Barry Revzin 2024-07-16 2024-07 P3294R0 SG7 Reflection,EWG Evolution
P3296R1 let_with_async_scope Anthony Williams 2024-06-24 2024-07 P3296R0 SG1 Concurrency and Parallelism,LEWG Library Evolution
P3297R1 C++26 Needs Contract Checking Ryan McDougall 2024-06-21 2024-07 P3297R0 SG21 Contracts,SG23 Safety and Security,EWG Evolution
P3303R1 Fixing Lazy Sender Algorithm Customization Eric Niebler 2024-06-24 2024-07 P3303R0 LEWG Library Evolution
P3309R1 constexpr atomic and atomic_ref Hana Dusíková 2024-07-14 2024-07 P3309R0 LEWG Library Evolution
P3310R1 Solving partial ordering issues introduced by P0522R0 Matheus Izvekov 2024-06-21 2024-07 P3310R0 EWG Evolution,CWG Core
P3310R2 Solving partial ordering issues introduced by P0522R0 Matheus Izvekov 2024-06-21 2024-07 P3310R1 EWG Evolution,CWG Core
P3314R0 2024-07 Library Evolution Polls Inbal Levi 2024-07-16 2024-07   LEWG Library Evolution
P3319R1 Add an iota object for simd (and more) Matthias Kretz 2024-06-28 2024-07 P3319R0 LEWG Library Evolution
P3321R0 Contracts Interaction With Tooling Joshua Berne 2024-07-12 2024-07   SG15 Tooling,SG21 Contracts,EWG Evolution
P3323R0 cv-qualified types in atomic and atomic_ref Gonzalo Brito Gadeschi 2024-06-16 2024-07   SG1 Concurrency and Parallelism
P3325R0 A Utility for Creating Execution Environments Eric Niebler 2024-06-13 2024-07   LEWG Library Evolution
P3325R1 A Utility for Creating Execution Environments Eric Niebler 2024-07-13 2024-07 P3325R0 LEWG Library Evolution
P3325R2 A Utility for Creating Execution Environments Eric Niebler 2024-07-16 2024-07 P3325R1 LEWG Library Evolution
P3326R0 favor ease of use Jarrad J. Waterloo 2024-06-13 2024-07   LEWG Library Evolution
P3328R0 Observable Checkpoints During Contract Evaluation Joshua Berne 2024-06-13 2024-07   SG21 Contracts
P3330R0 User-defined Atomic Read-Modify-Write Operations Gonzalo Brito 2024-06-17 2024-07   SG1 Concurrency and Parallelism
P3331R0 Accessing The First and Last Elements in Associative Containers Nikita Sakharin 2024-06-18 2024-07   LEWGI SG18: LEWG Incubator,LEWG Library Evolution,LWG Library
P3332R0 A simpler notation for PM Bjarne Stroustrup 2024-06-18 2024-07   EWG Evolution
P3335R0 Structured Core Options René Ferdinand Rivera Morell 2024-07-11 2024-07   SG15 Tooling
P3336R0 Usage Experience for Contracts with BDE Joshua Berne 2024-06-23 2024-07   SG21 Contracts,EWG Evolution
P3338R0 Observe and ignore semantics in constant evaluation Ville Voutilainen 2024-06-23 2024-07   EWG Evolution
P3339R0 C++ Ecosystem IS Open License René Ferdinand Rivera Morell 2024-06-23 2024-07   All of WG21
P3340R0 A Consistent Grammar for Sequences Alisdair Meredith 2024-06-24 2024-07   CWG Core
P3341R0 C++ Standard Library Ready Issues to be moved in St Louis, Jun. 2024 Jonathan Wakely 2024-06-24 2024-07   All of WG21
P3342R0 Working Draft, Standard for C++ Ecosystem René Ferdinand Rivera Morell 2024-07-11 2024-07   EWG Evolution,LEWG Library Evolution
P3343R0 Contracts - What are we doing here (EWG Presentation) Joshua Berne 2024-06-25 2024-07   EWG Evolution
P3344R0 Virtual Functions on Contracts (EWG - Presentation for P3097) Joshua Berne 2024-06-28 2024-07   EWG Evolution
P3345R0 Core Language Working Group "ready" Issues for the June, 2024 meeting Jens Maurer 2024-06-28 2024-07   CWG Core
P3351R0 views::scan Yihe Li 2024-07-08 2024-07   SG9 Ranges
P3354R0 Slides for P3233R0 Giuseppe D'Angelo 2024-07-09 2024-07   SG12 Undefined and Unspecified Behavior,EWG Evolution
P3355R0 Fix submdspan for C++26 Mark Hoemmen 2024-07-14 2024-07   LEWG Library Evolution
P3356R0 non_invalidating_vector Jarrad J Waterloo 2024-07-13 2024-07   LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P3357R0 NRVO with factory and after_factory TPK Healy 2024-07-15 2024-07   EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P3358R0 SARIF for Structured Diagnostics Sy Brand 2024-07-16 2024-07   SG15 Tooling
P3359R0 Slides for P3298R0 - Implicit conversion functions Bengt Gustafsson 2024-07-15 2024-07   EWGI SG17: EWG Incubator,EWG Evolution
P3360R0 Slides for P3312R0 - Overload Set Types Bengt Gustafsson 2024-07-15 2024-07   EWGI SG17: EWG Incubator

CppCon 2023 std::linalg: Linear Algebra Coming to Standard C++ -- Mark Hoemmen

hoemmen-stdlinalg.pngRegistration is now open for CppCon 2024! The conference starts on September 15 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2024!

CppCon 2023 std::linalg: Linear Algebra Coming to Standard C++

by Mark Hoemmen

Summary of the talk:

Many fields depend on linear algebra computations, which include matrix-matrix and matrix-vector multiplies, triangular solves, dot products, and norms. It's hard to implement these fast and accurately for all kinds of number types and data layouts. Wouldn't it be nice if C++ had a built-in library for doing that? Wouldn't it be even nicer if this library used C++ idioms instead of what developers have to do now, which is write nonportable, unsafe, verbose code for calling into an optimized Fortran or C library?

The std::linalg library does just that. It uses the new C++23 feature mdspan to represent matrices and vectors. The library builds on the long history and solid theoretical foundation of the BLAS (Basic Linear Algebra Subroutines), a standard C and Fortran interface with many optimized implementations. The C++ Standard Committee is currently reviewing std::linalg for C++26. The library already has two implementations that work with C++17 or newer compilers, and can take advantage of vendor-specific optimizations. Developers will see how std::linalg can make their C++ safer and more concise without sacrificing performance for use cases that existing BLAS libraries already optimize, while opening up new use cases and potential optimizations.

CppCon 2023 Spanny: Abusing C++ mdspan Is Within Arm’s Reach -- Griswald Brooks

brooks-spanny.pngRegistration is now open for CppCon 2024! The conference starts on September 15 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2024!

Lightning Talk: Spanny: Abusing C++ mdspan Is Within Arm’s Reach

by Griswald Brooks

Summary of the talk:

mdspan introduced in C++23 gave us a standard multidimensional way to view into a container of data. While the canonical use case is to refer to a stack or heap allocated data, the accessor policy allows you to inject any side effect allowing the data to come from anywhere... like a robot arm inspecting bins.

User-Defined Formatting in std::format – Part 2 -- Spencer Collyer

logo.pngLast time, we saw how to provide formatting for a simple user-defined class. Spencer Collyer builds on this, showing how to write a formatter for more complicated types.

User-Defined Formatting in std::format – Part 2

by Spencer Collyer

From the article:

In the previous article in this series [Collyer24], I showed how to write a class to format user-defined classes using the std::format library. In this article I will describe how this can be extended to container classes or any other class that holds objects whose type is specified by the user of your class.

A note on the code listings: The code listings in this article have lines labelled with comments like // 1. Where these lines are referred to in the text of this article, it will be as ‘line 1’ for instance, rather than ‘the line labelled // 1’.

Nested formatter objects

The objects created from the formatter template structs are just ordinary C++ objects – there is nothing special about them 1. In particular, there is nothing to stop you including an object of a formatter template type inside one of your user-defined formatter structs.

You might wonder why you would want to do that. One simple case is if you have a templated container class, and want to create a formatter that can output the container in one go, rather than having to write code to iterate over the container and output each value in turn. Having a nested formatter for the contained value type allows you to do this and allow the values to be formatted differently to the default, as the following examples will show. Other uses will no doubt come to mind for your own classes.

Qt and Trivial Relocation (Part 4) -- Giuseppe D'Angelo

dangeloqt.pngThe conclusion of the last post was that we need to change something in our models: maybe std::vector should use a different strategy when erasing elements; maybe types like std::tuple<int &> should not be allowed to be stored in a vector; maybe Qt should not be using memmove when erasing objects of trivially relocatable type (but it can still optimize the reallocation of a vector); maybe Qt’s definition of trivial relocability does not match ours, and we need to fix our definitions. In this post we will explore these possibilities and reach some conclusions.

Qt and Trivial Relocation (Part 4)

by Giuseppe D'Angelo

From the article:

As we have already discussed in the previous blog posts, it is possible to implement erasure in a number of ways, which are not equivalent. The Standard Library chose a specific implementation strategy (move-assign the elements after the ones to be destroyed to the left; destroy the moved-from last elements). Changing it now, over 26 years after the fact, sounds extremely scary; std::vector is such a central class that surely such a change would break somebody’s code.

That doesn’t mean that we can’t at least reason about a possible change there!

Also, there is another library that we keep talking about in these blog posts. This other library has a much smaller userbase than the Standard Library, and that has fewer regards with breaking backwards compatibility. We should certainly reason about that library as well. I’m talking about Qt, of course ��

Final report from using std::cpp 2024

From April 24th to 26th we had our annual edition of the C++ conference using std::cpp 2024. This is the major conference held in Spain since 2013.

Our final report has now been published:

Report from using std::cpp 2024

It includes answers to many interesting questions from the audience, not only about the conference, but also about the state of the C++ programming language ecosystem.

Do you want to know which is the most widely used version of the C++ language amont our attendees? What are the most popular platforms and compilers? Which tools are used?

And above all, do you really want to know which one was considered the best talk in the conference?

CppCon 2023 Robots Are After Your Job: Exploring Generative AI for C++ -- Andrei Alexandrescu

cpp23-alexandrescu.pngRegistration is now open for CppCon 2024! The conference starts on September 15 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2024!

Robots Are After Your Job: Exploring Generative AI for C++

by Andrei Alexandrescu

Summary of the talk:

Almost a year since the launch of ChatGPT – considered by many as the first truly compelling code generator that translates free-form human language into code – the C++ community continues to grapple with the implications. Reactions range from indifference or skepticism to genuine concern about the future of human programmers.

Although some advanced C++ techniques are already accessible to tools like ChatGPT, certain fundamental aspects remain outside the reach of current and possibly next-generation generative AI tools. This disparity raises pivotal questions: Which parts of the intricate C++ ecosystem can we confidently delegate to generative AI? What uniquely human skills must we retain and refine?

We'll probe the potential and limits of contemporary AI, taking a novel look at the age-old binary search algorithm. Although this algorithm has long been held up as a paragon of efficiency, we challenge that notion. What would ChatGPT have to say about it, and how might it partner with us to refine this cornerstone of algorithmic logic? The conversation opens a window into a future where developers become the "one percenters" of programming—focusing solely on the most cerebral and high-level challenges, while AI takes care of the everyday tasks. Join us to explore this fascinating paradigm shift and reflect on what it means for your own work in and with C++.

CppCon 2023 Coping With Other People's C++ Code -- Laura Savino

cpp23-savino.pngRegistration is now open for CppCon 2024! The conference starts on September 15 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2024!

Plenary: Coping With Other People's C++ Code

by Laura Savino

Summary of the talk:

Sometimes we're fortunate enough to work with a small group of devs who share our coding values, and when we see their PRs come in, we nod along and say, "Yup, that's what I would have done. Oh, nice, that one's even better than my usual approach, I'd better tuck that idea away for next time."

This perfect alignment is precious... and particularly elusive in C++. Most of us are living in codebases that are profitable, complex, and updated in ways with which we have legitimate beef. How can we keep a sense of curiosity, progress, and satisfaction amidst patterns we would never have chosen?

This presentation explores the often-overlooked social aspects of C++ development, offering both practical tools and light-hearted commiseration. We'll draw from the field of behavior science to build strategies that address conflicting design patterns and the strong opinions that come with them.

Qt and Trivial Relocation (Part 3) -- Giuseppe D'Angelo

kdab.pngIn the last post of this series we started exploring how to erase an element from the middle of a vector.

Qt and Trivial Relocation (Part 3)

by Giuseppe D'Angelo

From the article:

The reference semantics backstab

Let’s start by analyzing erase()‘s behavior once more.

Do you remember our claim that the specific strategy used does not really matter; that is, that they are all equivalent? Well, not so fast! It is actually quite imprecise to say that they are all equivalent.

They may be, as long as we deal with types which have value semantics. If we instead use a type that has reference semantics, the choices are absolutely not equivalent, and will yield different outcomes. This is because the semantics of assignment for (certain) reference types are write-through: they assign through the reference (instead of rebinding the reference).

Since we are implementing erasure in terms of assignments (or swaps, which boil down to assignments), this means that the precise sequence of operations done by erase will be visible due to its side-effects; and it also means that changing the strategy will produce different outcomes!

CppCon 2023 Writing a Better std::move -- Jonathan Müller

cpp23-muller.pngRegistration is now open for CppCon 2024! The conference starts on September 15 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2024!

Lightning Talk: Writing a Better std::move

by Jonathan Müller

Summary of the talk:

std::move allows the creation of const rvalue references, which is almost always wrong. It also allows moving out of lvalue references, which can be dangerous since you don't have real ownership over them and a caller might not expect the object to disappear. Let's fix those problems using macros, reflection, and more macros.