++namedtuple - Python style named tuples in C++20

Speaker: Kris Jusiak

Audience level: Intermediate

In this case study, we will take a look into how Python-style named tuples can be implemented in C++20.
The goal will be to test and implement the following snippet from scratch with modern C++ features.

01 const auto tuple = namedtuple{"price"_t = 42, "size"_t = 1'000u};
02 static_assert(42 == tuple["price"_t]);
03 static_assert(1'000u == tuple["size"_t]);

At the end of this session, the audience will have a better understanding of C++20 features such as:

  • Concepts
  • User-Defined Literals
  • New additions to lambdas
  • std::fixed_string

Additionally, attendees will get familiar with an expressive way of writing modern C++.

Let's get ready to named all tuples at Meeting C++ 2021!

[1] https://docs.python.org/3/library/collections.html