std::expected - Monadic Extensions -- Bartlomiej Filipek

BartlomiejFilipek-monadic.pngThe new std::expected feature from C++23 not only offers a robust error-handling mechanism but also introduces functional programming techniques like chaining operations with and_then, transforming results with transform, and managing errors using or_else and transform_error. This article explores these features, demonstrating how they can streamline your code by reducing redundant error checks while elegantly managing success and error states. Stay tuned as we dive into practical examples and see how these techniques are applied in real-world projects.

std::expected - Monadic Extensions

by Bartlomiej Filipek

From the article:

std::expected from C++23 not only serves as an error-handling mechanism but also introduces functional programming paradigms into the language. In this blog post, we’ll have a look at functional/monadic extensions of std::expected, which allow us to chain operations elegantly, handling errors at the same time. The techniques are very similar to std::optional extensions - see How to Use Monadic Operations for `std::optional` in C++23 - C++ Stories.

Here’s a brief overview of these functional capabilities:

and_then()
 
The and_then member function enables chaining operations that might produce a std::expected object. It’s invoked when the std::expected object holds a value and allows for seamless operation chaining without manual error checking after each step.
 

CppCon 2023 Back to Basics: Iterators in C++ -- Nicolai Josuttis

josuttiscpp23.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!

Back to Basics: Iterators in C++

by Nicolai Josuttis

Summary of the talk:

One key success factor of C++ was the introduction of the Standard Template Library (STL) bringing together containers/ranges and algorithms using iterators as glue API to iterate over elements of collections.

This talk will present the basics of the design of iterators, the various consequences, remarkable corner cases, and what this means when using ranges and views as introduced with C++20.

Adding State to the Update Notification Pattern, Part 5 -- Raymond Chen

RaymondChen_5in-150x150.jpgManaging stateful notifications is challenging when multiple requests arrive, and the goal is to only notify about the latest one. In the EditControl class, we use a counter to track the most recent request, updating it on the UI thread to ensure accurate ordering and prevent stale data from being processed. This approach works but is inefficient due to redundant calculations. Next time, we'll refine this strategy for greater efficiency.

Adding State to the Update Notification Pattern, Part 5 

by Raymond Chen

From the article:

We’ve been looking at the problem of a stateful but coalescing update notification, where multiple requests for work can arrive, and your only requirement is that you send a notification for the last one.

This time, we’ll apply the trick of using a counter to record who is doing the work on behalf of the most recent change. Here’s our first attempt:

 
class EditControl
{
    ⟦ ... existing class members ... ⟧

    unsigned m_latestId;
};

winrt::fire_and_forget
EditControl::TextChanged(std::string text)
{
    auto lifetime = get_strong();

    co_await winrt::resume_background();

    auto id = ++m_latestId;

    std::vector<std::string> matches;
    for (auto&& candidate : FindCandidates(text)) {
        if (candidate.Verify()) {
            matches.push_back(candidate.Text());
        }
    }

    co_await winrt::resume_foreground(Dispatcher());

    if (id != m_latestId) co_return;

    SetAutocomplete(matches);
}

CppCon 2023 Whitespace: A Humorous Short Talk -- Dan Curran

currancpp23.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: Whitespace: A Humorous Short Talk

by Dan Curran

Summary of the talk:

i want a holy war over whitespace. the most productive discussion.

2024-05 Mailing Available

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

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
N4983 WG21 agenda: 24-29 June 2024, St. Louis, MO, USA John Spicer 2024-05-19 2024-05   All of WG21
P0260R9 C++ Concurrent Queues Detlef Vollmann 2024-05-22 2024-05 P0260R8 SG1 Concurrency and Parallelism,LEWG Library Evolution
P0843R12 inplace_vector Gonzalo Brito Gadeschi 2024-05-21 2024-05 P0843R11 LWG Library
P0963R2 Structured binding declaration as a condition Zhihao Yuan 2024-05-14 2024-05 P0963R1 EWG Evolution,CWG Core
P1000R6 C++ IS schedule Herb Sutter 2024-05-19 2024-05 P1000R5 All of WG21
P1083R8 Move resource_adaptor from Library TS to the C++ WP Pablo Halpern 2024-05-22 2024-05 P1083R7 LEWG Library Evolution,LWG Library
P1112R5 Language support for class layout control Pal Balog 2024-05-21 2024-05 P1112R4 EWG Evolution
P1144R11 std::is_trivially_relocatable Arthur O'Dwyer 2024-05-15 2024-05 P1144R10 EWGI SG17: EWG Incubator
P1255R13 A view of 0 or 1 elements: views::nullable And a concept to constrain maybes Steve Downey 2024-05-22 2024-05 P1255R12 LEWG Library Evolution,LWG Library
P1306R2 Expansion statements Dan Katz 2024-05-07 2024-05 P1306R1 EWG Evolution
P1494R3 Partial program correctness S. Davis Herring 2024-05-21 2024-05 P1494R2 SG22 Compatibility,EWG Evolution,LEWG Library Evolution,CWG Core
P1928R9 std::simd - Merge data-parallel types from the Parallelism TS 2 Matthias Kretz 2024-05-22 2024-05 P1928R8 LWG Library
P2019R6 Thread attributes Corentin Jabot 2024-05-22 2024-05 P2019R5 LWG Library
P2034R4 Partially Mutable Lambda Captures Ryan McDougall 2024-04-22 2024-05 P2034R3 SG23 Safety and Security,EWG Evolution,CWG Core
P2079R4 System execution context Lee Howes 2024-05-22 2024-05 P2079R3 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2413R1 Remove unsafe conversions of unique_ptr Lénárd Szolnoki 2024-05-22 2024-05 P2413R0 LEWG Library Evolution
P2434R1 Nondeterministic pointer provenance S. Davis Herring 2024-05-21 2024-05 P2434R0 SG22 Compatibility,EWG Evolution
P2689R3 Atomic Refs Bound to Memory Orderings & Atomic Accessors Christian Trott 2024-04-29 2024-05 P2689R2 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2719R0 Type-aware allocation and deallocation functions Louis Dionne 2024-05-18 2024-05   EWGI SG17: EWG Incubator,EWG Evolution
P2758R3 Emitting messages at compile time Barry Revzin 2024-05-19 2024-05 P2758R2 EWG Evolution,LEWG Library Evolution
P2761R1 Slides: If structured binding (P0963R1 presentation) Zhihao Yuan 2024-05-01 2024-05 P2761R0 EWG Evolution
P2786R6 Trivial Relocatability For C++26 Mungo Gill 2024-05-21 2024-05 P2786R5 EWG Evolution,LEWG Library Evolution
P2822R1 Providing user control of associated entities of class types Lewis Baker 2024-05-08 2024-05 P2822R0 EWG Evolution
P2830R4 Standardized Constexpr Type Ordering Gašper Ažman 2024-05-21 2024-05 P2830R3 EWG Evolution
P2835R4 Expose std::atomic_ref's object address Gonzalo Brito Gadeschi 2024-05-21 2024-05 P2835R3 LEWG Library Evolution
P2841R3 Concept and variable-template template-parameters Corentin Jabot 2024-05-22 2024-05 P2841R2 CWG Core
P2846R2 reserve_hint: Eagerly reserving memory for not-quite-sized lazy ranges Corentin Jabot 2024-05-22 2024-05 P2846R1 LEWG Library Evolution
P2849R0 async-object - aka async-RAII objects Kirk Shoop 2024-05-21 2024-05   SG1 Concurrency and Parallelism,LEWG Library Evolution
P2876R1 Proposal to extend std::simd with more constructors and accessors Daniel Towner 2024-05-22 2024-05 P2876R0 LEWG Library Evolution
P2900R7 Contracts for C++ Joshua Berne 2024-05-22 2024-05 P2900R6 EWG Evolution,LEWG Library Evolution
P2963R2 Ordering of constraints involving fold expressions Corentin Jabot 2024-05-22 2024-05 P2963R1 CWG Core
P2964R1 Allowing user-defined types in std::simd Daniel Towner 2024-05-22 2024-05 P2964R0 SG6 Numerics,LEWG Library Evolution
P2967R1 Relocation Is A Library Interface Alisdair Meredith 2024-05-22 2024-05 P2967R0 LEWG Library Evolution
P2971R2 Implication for C++ Walter E Brown 2024-05-21 2024-05 P2971R1 EWG Evolution,LEWG Library Evolution
P2976R1 Freestanding Library: algorithm, numeric, and random Ben Craig 2024-05-05 2024-05 P2976R0 LWG Library
P2988R5 std::optional<T&> Steve Downey 2024-05-22 2024-05 P2988R4 LEWG Library Evolution,LWG Library
P2996R3 Reflection for C++26 Barry Revzin 2024-05-22 2024-05 P2996R2 EWG Evolution
P3045R1 Quantities and units library Mateusz Pusz 2024-05-22 2024-05 P3045R0 SG6 Numerics,SG16 Unicode,LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P3051R1 Structured Response Files René Ferdinand Rivera Morell 2024-05-20 2024-05 P3051R0 SG15 Tooling
P3059R1 Making user-defined constructors of view iterators/sentinels private Hewill Kang 2024-05-16 2024-05 P3059R0 SG9 Ranges,LEWG Library Evolution
P3064R1 How to Avoid OOTA Without Really Trying Paul E. McKenney 2024-05-14 2024-05 P3064R0 SG1 Concurrency and Parallelism
P3067R0 Provide predefined simd permute generator functions for common operations Daniel Towner 2024-05-22 2024-05   LEWG Library Evolution
P3068R2 Allowing exception throwing in constant-evaluation Hana Dusíková 2024-05-22 2024-05 P3068R1 EWG Evolution,LEWG Library Evolution
P3085R2 `noexcept` policy for SD-9 (throws nothing) Ben Craig 2024-05-18 2024-05 P3085R1 LEWG Library Evolution
P3091R2 Better lookups for `map` and `unordered_map` Pablo Halpern 2024-05-21 2024-05 P3091R1 LEWG Library Evolution
P3094R2 std::basic_fixed_string Mateusz Pusz 2024-05-22 2024-05 P3094R1 SG16 Unicode,LEWGI SG18: LEWG Incubator,LEWG Library Evolution
P3096R1 Function Parameter Reflection in Reflection for C++26 Adam Lach 2024-05-15 2024-05 P3096R0 EWG Evolution,LEWG Library Evolution
P3100R0 Undefined and erroneous behaviour are contract violations Timur Doumler 2024-05-21 2024-05   SG21 Contracts,SG23 Safety and Security,EWG Evolution
P3103R2 More bitset operations Jan Schultke 2024-05-22 2024-05 P3103R1 LEWGI SG18: LEWG Incubator
P3111R0 Atomic Reduction Operations Gonzalo Brito Gadeschi 2024-05-22 2024-05   SG1 Concurrency and Parallelism,SG6 Numerics
P3119R1 Tokyo Technical Fixes to Contracts Joshua Berne 2024-05-09 2024-05 P3119R0 SG21 Contracts
P3125R0 Pointer tagging Hana Dusíková 2024-05-22 2024-05   SG1 Concurrency and Parallelism
P3126R1 Graph Library: Overview Phil Ratzloff 2024-05-20 2024-05 P3126R0 SG14 Low Latency,SG19 Machine Learning
P3130R1 Graph Library: Graph Container Interface Phil Ratzloff 2024-05-20 2024-05 P3130R0 SG14 Low Latency,SG19 Machine Learning
P3131R1 Graph Library: Containers Phil Ratzloff 2024-05-20 2024-05 P3131R0 SG14 Low Latency,SG19 Machine Learning
P3137R1 views::to_input Tim Song 2024-05-21 2024-05 P3137R0 SG9 Ranges
P3138R1 views::cache_last Tim Song 2024-05-21 2024-05 P3138R0 SG1 Concurrency and Parallelism,LEWG Library Evolution
P3139R0 Pointer cast for unique_ptr Zhihao Yuan 2024-05-20 2024-05   LEWG Library Evolution
P3149R3 async_scope -- Creating scopes for non-sequential concurrency Ian Petersen 2024-05-21 2024-05 P3149R2 LEWG Library Evolution
P3154R1 Deprecating signed character types in iostreams Elias Kosunen 2024-05-20 2024-05 P3154R0 LEWG Library Evolution
P3157R1 Generative Extensions for Reflection Andrei Alexandrescu 2024-05-22 2024-05 P3157R0 SG7 Reflection
P3175R1 Reconsidering the `std::execution::on` algorithm Eric Niebler 2024-05-14 2024-05 P3175R0 LEWG Library Evolution
P3175R2 Reconsidering the `std::execution::on` algorithm Eric Niebler 2024-05-21 2024-05 P3175R1 LEWG Library Evolution
P3179R1 C++ parallel range algorithms Ruslan Arutyunyan 2024-05-22 2024-05 P3179R0 SG1 Concurrency and Parallelism,SG9 Ranges
P3183R1 Contract testing support Bengt Gustafsson 2024-05-22 2024-05 P3183R0 SG21 Contracts
P3210R1 A Postcondition *is* a Pattern Match Andrew Tomazos 2024-04-20 2024-05 P3210R0 SG21 Contracts,EWG Evolution
P3214R0 2024-04 Library Evolution Poll Outcomes Inbal Levi 2024-05-22 2024-05   LEWG Library Evolution
P3228R1 Contracts for C++: Revisiting contract check elision and duplication Timur Doumler 2024-05-21 2024-05 P3228R0 SG21 Contracts,EWG Evolution
P3234R1 Utility to check if a pointer is in a given range Glen Joseph Fernandes 2024-04-29 2024-05 P3234R0 EWG Evolution,LEWG Library Evolution
P3235R0 std::print more types faster with less memory Victor Zverovich 2024-05-11 2024-05   LEWG Library Evolution
P3236R1 Please reject P2786 and adopt P1144 Alan de Freitas 2024-05-21 2024-05 P3236R0 All of WG21
P3238R0 An alternate proposal for naming contract semantics Ville Voutilainen 2024-05-06 2024-05   SG21 Contracts
P3239R0 A Relocating Swap Alisdair Meredith 2024-05-22 2024-05   EWG Evolution,LEWG Library Evolution
P3247R1 Deprecate the notion of trivial types Jens Maurer 2024-05-19 2024-05 P3247R0 LEWG Library Evolution,CWG Core
P3248R0 Require [u]intptr_t Gonzalo Brito Gadeschi 2024-05-20 2024-05   SG1 Concurrency and Parallelism,SG22 Compatibility,EWG Evolution,LEWG Library Evolution
P3249R0 A unified syntax for Pattern Matching and Contracts when introducing a new name Ran Regev 2024-04-22 2024-05   SG21 Contracts,EWG Evolution
P3250R0 C++ contracts with regards to function pointers Peter Bindels 2024-05-07 2024-05   SG21 Contracts
P3251R0 C++ contracts and coroutines Peter Bindels 2024-05-07 2024-05   SG21 Contracts
P3253R0 Distinguishing between member and free coroutines Brian Bi 2024-05-22 2024-05   EWG Evolution,LEWG Library Evolution
P3254R0 Reserve identifiers preceded by @ for non-ignorable annotation tokens Brian Bi 2024-05-22 2024-05   EWG Evolution
P3255R0 Expose whether atomic notifying operations are lock-free Brian Bi 2024-05-22 2024-05   SG1 Concurrency and Parallelism
P3257R0 Make the predicate of contract_assert more regular Jens Maurer 2024-04-26 2024-05   SG21 Contracts,EWG Evolution
P3258R0 Formatting charN_t Corentin Jabot 2024-05-22 2024-05   SG16 Unicode,LEWG Library Evolution
P3259R0 const by default Jarrad J Waterloo 2024-05-09 2024-05   EWG Evolution
P3263R0 Encoded annotated char Tiago Freire 2024-05-03 2024-05   SG16 Unicode,LEWGI SG18: LEWG Incubator
P3264R0 Double-evaluation of preconditions Ville Voutilainen 2024-05-17 2024-05   EWG Evolution
P3264R1 Double-evaluation of preconditions Ville Voutilainen 2024-05-17 2024-05 P3264R0 EWG Evolution
P3265R0 Ship Contracts in a TS Ville Voutilainen 2024-05-07 2024-05   EWG Evolution
P3265R1 Ship Contracts in a TS Ville Voutilainen 2024-05-22 2024-05 P3265R0 EWG Evolution
P3266R0 non referenceable types Jarrad J Waterloo 2024-05-05 2024-05   EWG Evolution
P3267R0 C++ contracts implementation strategies Peter Bindels 2024-05-16 2024-05   SG15 Tooling,SG21 Contracts
P3267R1 Approaches to C++ Contracts Peter Bindels 2024-05-22 2024-05 P3267R0 SG15 Tooling,SG21 Contracts
P3268R0 C++ Contracts Constification Challenges Concerning Current Code Peter Bindels 2024-05-07 2024-05   SG21 Contracts,EWG Evolution
P3269R0 Do Not Ship Contracts as a TS Timur Doumler 2024-05-21 2024-05   SG21 Contracts,EWG Evolution
P3270R0 Repetition, Elision, and Constification w.r.t. contract_assert John Lakos 2024-05-22 2024-05   SG21 Contracts
P3271R0 Function Usage Types (Contracts for Function Pointers) Lisa Lippincott 2024-05-20 2024-05   SG21 Contracts
P3273R0 Introspection of Closure Types Andrei Alexandrescu 2024-05-22 2024-05   SG7 Reflection
P3274R0 A framework for Profiles development Bjarne Stroustrup 2024-05-09 2024-05   SG23 Safety and Security,EWG Evolution,LEWG Library Evolution
P3275R0 Replace simd operator[] with getter and setter functions - or not Matthias Kretz 2024-05-22 2024-05   LEWG Library Evolution
P3276R0 P2900 Is Superior to a Contracts TS Joshua Berne 2024-05-17 2024-05   SG21 Contracts,EWG Evolution
P3278R0 Analysis of interaction between relocation, assignment, and swap Nina Ranns 2024-05-22 2024-05   EWG Evolution,LEWG Library Evolution
P3279R0 CWG2463: What 'trivially fooable' should mean Arthur O'Dwyer 2024-05-15 2024-05   EWGI SG17: EWG Incubator
P3281R0 Contact checks should be regular C++ John Spicer 2024-05-15 2024-05   SG21 Contracts,EWG Evolution
P3282R0 Static Storage for C++ Concurrent bounded_queue Detlef Vollmann 2024-05-19 2024-05   SG1 Concurrency and Parallelism,SG14 Low Latency,LEWG Library Evolution
P3283R0 Adding .first() and .last() to strings Rhidian De Wit 2024-05-16 2024-05   LEWGI SG18: LEWG Incubator
P3284R0 `finally`, `write_env`, and `unstoppable` Sender Adaptors Eric Niebler 2024-05-15 2024-05   LEWG Library Evolution
P3285R0 Contracts: Protecting The Protector Gabriel Dos Reis 2024-05-15 2024-05   SG23 Safety and Security,EWG Evolution
P3286R0 Module Metadata Format for Distribution with Pre-Built Libraries Daniel Ruoso 2024-05-22 2024-05   SG15 Tooling
P3287R0 Exploration of namespaces for std::simd Matthias Kretz 2024-05-22 2024-05   LEWG Library Evolution
P3288R0 std::elide Thomas P. K. Healy 2024-05-22 2024-05   EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P3289R0 Consteval blocks Daveed Vandevoorde 2024-05-21 2024-05   EWG Evolution
P3290R0 Integrating Existing Assertions With Contracts Joshua Berne 2024-05-22 2024-05   SG21 Contracts
P3292R0 Provenance and Concurrency David Goldblatt 2024-05-17 2024-05   SG1 Concurrency and Parallelism
P3293R0 Splicing a base class subobject Barry Revzin 2024-05-19 2024-05   EWG Evolution
P3294R0 Code Injection with Token Sequences Barry Revzin 2024-05-22 2024-05   SG7 Reflection,EWG Evolution
P3295R0 Freestanding constexpr containers and constexpr exception types Ben Craig 2024-05-21 2024-05   SG7 Reflection,LEWG Library Evolution
P3296R0 let_with_async_scope Anthony Williams 2024-05-22 2024-05   SG1 Concurrency and Parallelism,LEWG Library Evolution
P3297R0 C++26 Needs Contract Checking Ryan McDougall 2024-05-20 2024-05   SG21 Contracts,SG23 Safety and Security,EWG Evolution
P3298R0 Implicit user-defined conversion functions as operator.() Bengt Gustafsson 2024-05-22 2024-05   EWGI SG17: EWG Incubator
P3299R0 Range constructors for std::simd Daniel Towner 2024-05-22 2024-05   LEWG Library Evolution
P3301R0 inplace_stoppable_base Lauri Vasama 2024-05-21 2024-05   LEWG Library Evolution
P3302R0 SG16: Unicode meeting summaries 2024-03-13 through 2024-05-08 Tom Honermann 2024-05-21 2024-05   SG16 Unicode
P3303R0 Fixing Lazy Sender Algorithm Customization Eric Niebler 2024-05-21 2024-05   LEWG Library Evolution
P3304R0 SG14: Low Latency/Games/Embedded/Financial Trading virtual Meeting Minutes 2024/04/10 Michael Wong 2024-05-21 2024-05   SG14 Low Latency
P3305R0 SG19: Machine Learning virtual Meeting Minutes to 2024/04/11-2024/05/09 Michael Wong 2024-05-21 2024-05   SG19 Machine Learning
P3306R0 Atomic Read-Modify-Write Improvements Gonzalo Brito Gadeschi 2024-05-22 2024-05   SG1 Concurrency and Parallelism,SG6 Numerics
P3307R0 Floating-Point Maximum/Minimum Function Objects Gonzalo Brito Gadeschi 2024-05-21 2024-05   SG6 Numerics
P3308R0 mdarray design questions and answers Mark Hoemmen 2024-05-21 2024-05   LEWG Library Evolution
P3309R0 constexpr atomic and atomic_ref Hana Dusíková 2024-05-22 2024-05   SG1 Concurrency and Parallelism,LEWG Library Evolution
P3310R0 Solving partial ordering issues introduced by P0522R0 Matheus Izvekov 2024-05-22 2024-05   EWG Evolution,CWG Core
P3311R0 An opt-in approach for integration of traditional assert facilities in C++ contracts Tom Honermann 2024-05-22 2024-05   SG21 Contracts
P3312R0 Overload Set Types Bengt Gustafsson 2024-05-22 2024-05   EWGI SG17: EWG Incubator
P3313R0 Impacts of noexept on ARM table based exception metadata Khalil Estell 2024-05-22 2024-05   EWG Evolution,LEWG Library Evolution
P3316R0 A more predictable unchecked semantic Jonas Persson 2024-05-22 2024-05   SG21 Contracts
P3317R0 Compile time resolved contracts Jonas Persson 2024-05-22 2024-05   SG21 Contracts
P3318R0 Throwing violation handlers, from an application programming perspective Ville Voutilainen 2024-05-22 2024-05   LEWG Library Evolution
P3319R0 Add an iota object for simd (and more) Matthias Kretz 2024-05-22 2024-05   LEWG Library Evolution
P3320R0 EWG slides for P3144 "Delete if Incomplete" Alisdair Meredith 2024-05-22 2024-05   EWG Evolution
P4000R0 To TS or not to TS: that is the question Michael Wong 2024-05-22 2024-05   All of WG21

CppCon 2023 C++23: An Overview of Almost All New and Updated Features -- Marc Gregoire

gregoirecpp23.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!

C++23: An Overview of Almost All New and Updated Features

by Marc Gregoire

Summary of the talk:

As I have done for previous C++ Standard versions, I will explore almost all new and updated C++ features that come with the C++23 standard. C++23 is not as big of an update as C++20 was, but it does contain numerous new and updated features to both the core language and the Standard Library. The goal of this session is not to discuss all new and changed features in detail, as that is not possible in a one-hour session. Instead, at the end of the session, you should have a high-level overview of everything that's new or changed in C++23, and it might even change how you are using existing features.

The session will touch on the following core language and Standard Library topics.

C++23 core language changes include explicit object parameters (deducing this), if consteval, multidimensional subscript operators, built-in decay copy support, ability to mark unreachable code, support for specifying platform-independent assumptions, named universal character escapes, and more.

C++23 Standard Library changes include string formatting improvements, formatting of entire ranges, standard named modules std and std.compat, new containers flat_map and flat_set, multidimensional span aka mdspan, a standard generator coroutine, monadic operations on optionals, working with stacktraces at run time, many changes to the ranges library, std::expected as an alternative to exceptions, and more.

Throughout the session, the slides will contain references to other CppCon sessions with more details on specific topics.

Noisy: The Class You Wrote a Hundred Times -- Vincent Zalzal

OXUJNJk0_400x400.jpgYou have probably written a class that prints a message in all its special member functions. And like me, you probably wrote it multiple times. I decided to write it well once and for all, and share it.

Noisy: The Class You Wrote a Hundred Times

by Vincent Zalzal

From the article:

Recently, I was writing some code involving structured bindings and I was unsure whether it would incur unintended copy or move operations. As usual, when I am in this situation, I open up Compiler Explorer and test it. For the nth time, I ended up coding a class like this one:

struct S { 
S() { std::cout << "ctor\n"; } 
~S() { std::cout << "dtor\n"; } 
// ... and so on with copy and move operations 
}

I don’t know how many times I wrote this class! I thought maybe it was time I write it well, once and for all, and then reuse it when I need it. And then, I thought that I am probably not the only one having written that class over and over again, am I? Maybe this could be useful to others.

The Performance Impact of C++'s `final` Keyword -- Benjamin Summerton

book2_final_scene.pngIf you're writing C++, there's a good reason (maybe...) as to why you are. And probably, that reason is performance. So often when reading about the language you'll find all sorts of "performance tips and tricks" or "do this instead because it's more efficient". Sometimes you get a good explanation as to why you should. But more often than not, you won't find any hard numbers to back up that claim. I recently found a peculiar one, the final keyword.

The Performance Impact of C++'s `final` Keyword

by Benjamin Summerton

From the article:

Multiple blog posts claim that it can improve performance(sorry for linking a Medium article). It almost seems like it's almost free, and for a very measly change. After reading you'll notice something interesting: no one posted any metrics. Zero. Nada. Zilch. It essentially is "just trust me bro." Claims of performance improvements aren't worth salt unless you have the numbers to back it up. You also need to be able to reproduce the results. I've been guilty of this in the past (see a PR for Godot I made).

Being a good little engineer with a high performance C++ pet project, I really wanted to validate this claim.

CppCon 2023 A Journey Into Non-Virtual Polymorphism in C++ -- Rudyard Merriam

merriamcpp23.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 A Journey Into Non-Virtual Polymorphism in C++

by Rudyard Merriam

Summary of the talk:

Join me on an introductory journey into polymorphism that doesn't use class inheritance and virtual functions. I'll share my amazement at how polymorphism permeates C++. Then we'll visit the long-used Curiously Recurring Template Pattern (CRTP) with its modernization using implicit this.

Do you like lambdas? So does the override pattern, which uses them to handle std::tuples and std::variants with std::apply and std::visit.

Want to walk through a container of disparate types invoking their functions? You'll see this and all the above in code examples galore.

Afterward, you'll be eager to learn more on your own!

Pure Virtual C++ 2024 Recordings Available

The recordings for all Pure Virtual C++ 2024 sessions are now online. This includes the 5 main sessions plus over a dozen pre-conference videos.

Pure Virtual C++ 2024 Recordings Available

By Sy Brand

From the article:

All recordings for our Pure Virtual C++ 2024 conference are now available. Thanks to everyone who came along and hope to see you again next year! You can find the full playlist on YouTube.