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.

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

RaymondChen_5in-150x150.jpgIn our previous discussion, we explored the intricacies of stateful but coalescing update notifications, shedding light on the pivotal role of the UI thread in implicit serialization. However, what if this luxury of implicit synchronization is absent? Delving into an alternate version of our solution, we confront the looming specter of race conditions and the necessity for meticulous thread management to ensure seamless operation. Join us as we navigate the complexities of thread synchronization and embark on a quest to refine our approach to asynchronous work handling.  

Adding State to the Update Notification Pattern, Part 4

by Raymond Chen

From the article:

Last time, we developed a stateful but coalescing update notification, and we noted that the UI thread was doing a lot of heavy lifting. What if you don’t have a UI thread to do implicit serialization for you?

If there were no resume_foreground(Dispatcher()), we would have a race if a Text­Changed occurs after the worker has decided to exit, but before it has had a chance to mark itself as not busy. Here’s an alternate version that demonstrates the race.

CppCon 2023 A Fast, Concurrent Data Loader for Time-Series Data -- Glenn Philen

philencpp23.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: A Fast, Concurrent Data Loader for Time-Series Data

by Glenn Philen

Summary of the talk:

In this talk, I briefly share the design of a high performance data loader used to iterating over time series data stored on disk across many individual files. The data loader aggregates data streams from different sources and of different kinds of data, orders it by timestamp, and feeds it to an offline test harness concurrently and without locking.

Trip Report: Winter ISO C++ Meeting in Tokyo, Japan -- David Sankel

tokyoreport.pngAnother meeting, another slew of potential changes to standard C++. In this recap, I’ll summarize the working draft’s most significant changes, spotlight my favorite proposal at the meeting, Member customization points for Senders and Receivers, and discuss a handful of notable developments.

Trip Report: Winter ISO C++ Meeting in Tokyo, Japan

by David Sankel

From the article:

What’s new in the draft standard?

This snippet summarizes the notable changes:


	// wg21.link/p2573r2

	void newapi();

	void oldapi() = delete(“oldapi() is outdated, use newapi() instead”);

	

	void f() {

	    std::println(); // Shorthand for ‘std::println(“”)’. wg21.link/p3142r0

	

	    // Paths can be printed/formatted now. wg21.link/p2845r8

	    std::println(“Here’s a path: {}”,

	                 std::filesystem::path(“/stlab/chains”));

	

	    std::vector<int> x{1, 2, 3};

	    std::array<int,3> y{4, 5, 6};

	

	    // Outputs 1, 2, 3, 4, 5, and 6 separated by newlines.

	    for( auto i : std::views::concat(x, y) ) // concat is new from

	        std::cout << i << std::endl;         // wg21.link/p2542r8

	}

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

RaymondChen_5in-150x150.jpgIn our continued exploration of efficient stateful update notifications, we delve into optimizing our existing solution to mitigate unnecessary background work. By introducing periodic checks for pending text and leveraging mutex protection, we aim to streamline the process and enhance performance. However, as we unravel these optimizations, we confront the complexities of managing thread safety and delve into the intricacies of background thread synchronization.

Adding State to the Update Notification Pattern, Part 3

by Raymond Chen

From the article:

Last time, we developed a stateful but coalescing update notification, and we noted that the code does a lot of unnecessary work because the worker thread calculates all the matches, even if the work has been superseded by another request.

We can add an optimization to abandon the background work if it notices that its efforts are going to waste: Periodically check whether there is any pending text. This will cost us a mutex, however, to protect access to m_pendingText from multiple threads.