Skip to content

Implementing variant visitation by-lambda and Value Types Checklist

Photo of Phil Nash
Hosted By
Phil N. and 2 others
Implementing variant visitation by-lambda and Value Types Checklist

Details

I'm pleased to welcome Vittorio Romeo and Dietmar Kühl this month.

(Please note this is a change from the earlier programme due to unforeseen circumstances).

(As before, please also register on the SkillsMatter page) (https://skillsmatter.com/meetups/9471-c-plus-plus-may-meetup)

Agenda:

18:30 pre-session networking/ drinks and getting that good seat at the front

19:00 Phil Nash (https://www.meetup.com/CppLondon/members/48127252/) << "Hello World"

Brief introduction and raffle for a JetBrains license

19:10 Vittorio Romeo (http://vittorioromeo.info) << "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.

19:50 // Questions, hand-over, break

20:00 Dietmar Kühl (https://www.meetup.com/CppLondon/members/195139736/) << "Value types checklist: considerations to take into account when writing value types"

Abstract TBA, but will be based on https://gist.github.com/dietmarkuehl/74693bb2658ebeda8faa#allocator-awareness

---

We'll finish around 20:40-20:45 at which point we'll adjourn to the bar/ nearby hostelry for more informal discussion and networking.

About the speakers:

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.

Dietmar Kühl is a senior software developer at Bloomberg L.P. working on the data distribution environment used both internally and by enterprise installations at clients. Before joining Bloomberg he has done mainly consulting for software projects in the finance area. He is a regular attendee of the ANSI/ISO C++ standards committee, presents at conferences, and he used to be a moderator of the newsgroup comp.lang.c++.moderated. He frequently answers questions on Stackoverflow.

Photo of C++ London group
C++ London
See more events
Skills Matter | Code Node
10 South Place EC2M 2RB · London