Visiting variants using lambdas (2: recursive variants) -- Vittorio Romeo

The article addresses the problem of lambda-based `std::variant` and `boost::variant` recursive visitation. Starting from the definition of a "recursive variant", it shows the concept and implementation behind a `make_recursive_visitor` variadic function that can be used to create "local" visitors by using lambdas.

visiting variants using lambdas - part 2

By Vittorio Romeo

From the article:

A "recursive" variant is a variant which can contain itself, and can be used to represent recursive structures. [...] Bringing algebraic data types from the functional programming world into C++ isn't enough - we're also going to adopt another powerful construct: the Y Combinator. [...] Now we can put everything together to finally visit a recursive variant using lambdas!

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.