CppCon 2023 Spanny: Abusing C++ mdspan Is Within Arm’s Reach -- Griswald Brooks
Registration 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.

Last 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.
The 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.
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
In the last post of this series we started exploring how to erase an element from the middle of a vector.
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
In recent discussions around the use of std::move in C++, questions have arisen regarding its potential overuse and the compiler's treatment of its return values. Addressing concerns raised by developers like Jonathan Duncan, this article delves into the nuances of