++namedtuple – Python-style Named Tuples in C++20 – Kris Jusiak – CppCon 2021

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
In this workshop, 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'000};
02 static_assert(42 == tuple["price"_t]);
03 static_assert(1'000 == tuple["size"_t]);
04 static_assert(not [](auto tuple) { return requires { tuple["quantity"_t];}(tuple))

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 CppCon 2021!

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

---
Kris Jusiak

Kris is a Software Architect passionate about programming and who has worked in different industries over the years including telecommunications, games and most recently finance for Quantlab Financial, LLC. He has an interest in modern C++ development with a focus on performance and quality. He is an open-source enthusiast with multiple open-source libraries where he uses template meta-programming techniques to support the C++ rule - "Don't pay for what you don't use" whilst trying to be as declarative as possible with a help of domain-specific languages. Kris is also a keen advocate of extreme programming techniques, Test/Behavior Driven Development and truly believes that 'the only way to go fast is to go well!'.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

No comment yet, add your voice below!


Add a Comment