Structured bindings uncovered

Dawid Zalewski

60 minute presentation
intermediate
beginner

Have you ever used structured bindings to simplify your code? If you are on C++17 chances are that you answered yes. Have you given them a second thought? You should have - they are not what they appear to be. They were introduced to the language recently as means to simplify object decomposition. They look like normal variables. However, they are not even close to variables - they cannot be constexpr, they cannot be captured by lambdas, they cannot...

In this talk we will take a look under the hood of structured bindings. We'll see how they are implemented, what it means for a programmer and what costs it can bring along. We'll explore the limitations of structured bindings and see how some of them were lifted in C++20. Finally, we will learn how to enable structured bindings for a custom type and how to avoid hidden costs of decomposition by smart design or use of wrappers.

structured bindings
C++20

Dawid Zalewski

Dawid is a computer engineer with a heart for teaching. He's been programming for over 20 years evolving through Basic, Turbo Pascal and many other languages to finally find his home in the land of C++ (with occasional visits to Python). He teaches at Saxion University of Applied Sciences in the Netherlands, where he tries to convert new generations of programmers to use modern C++. Besides teaching, he uses C++ in the research on probabilistic state estimation for industrial applications. His interests focus on the design and evolution of programming languages and paradigms. In his free time he explores the forming landscape of data-driven education or reads books.