Meet up

Practical Applications of Reflection & Implementing variant visitation by-lambda

Thursday, 11th May in London

This meetup was organised by C++ London in May 2017


Don't miss this C++ meetup with talks from Jackie Kay and Vittorio Romeo.

Implementing `variant` visitation using lambdas

The addition of `std::variant` to the upcoming C++17 standard will introduce a "type-safe sum type" to the Standard Library. Variants model a "choice between types" - they essentially are type-safe "tagged unions".

The interface they expose, however, is often more cumbersome to use than it needs to be: defining exhaustive visitors requires the user to create a class with several operator() overloads, or to create a chain of if constexpr(...) calls. Both solutions are not very elegant.

After a brief overview of std::variant and its usefulness, this talk will focus on the implementation of a "lambda-based in-place visitation" approach, where the user can visit a variant by simply providing a set of lambdas on the spot. This will require implementing a way of overloading arbitrary function objects.

Recursive variant types will then be covered and the "lambda-based" visitation techniques will be applied to them. This will require implementing the "Y combinator" higher-order function to achieve zero-runtime-overhead lambda recursion.

This talk is intended for developers familiar with C++11 and C++14 core language features (lambdas, variadic templates, auto, etc...). Prior knowledge of std::variant or sum types is not required.

Vittorio Romeo

Vittorio Romeo is a C++ enthusiast from a young age, now with a BS in Computer Science from the "Università degli Studi di Messina". While following the evolution of the C++ standard and embracing the newest features, he worked on several open-source projects, including modern general-purpose libraries and free cross-platform indie games. Vittorio is an active member of the C++ community, speaking at many conferences and events. He currently maintains a YouTube channel featuring well-received modern C++11 and C++14 tutorials. When he's not writing code, Vittorio enjoys weightlifting and fitness-related activities, competitive/challenging computer gaming and good sci-fi movies/TV-series.

Practical Applications of Reflection

What is reflection? Why is it considered "black magic" by some? And do we really need more black magic in C++? This talk covers the art of reflection: the ability to inspect (and maybe even modify) the data members and other qualities of a type. We will briefly look at how reflection is implemented in other languages and how it is achieved in C++ today through macros or compiler plugins. We will also compare current proposals for reflection targeting C++20 and present example utilities implemented using the reference implementation of the "reflexpr" proposal in Clang.

Jackie Kay

Jackie Kay is a professional robotics software engineer, embedded software hobbyist, and amateur template metaprogrammer from the United States. Her open source work includes contributions to the ROS application framework for robotics, the Gazebo physics simulator, and work-in-progress contributions to the Kvasir bare metal embedded software libraries.

Thanks to our sponsors

Who's coming?

Attending Members