The article covers a technique that allows variant types (both `std::variant` and `boost::variant`) to be visited using lambdas, without having to explicitly create a functor.
visiting variants using lambdas - part 1
By Vittorio Romeo
From the article:
Visiting a variant is usually done by writing a visitor struct/class outside of the scope where the variant is actually being visited. [...] It is possible to build such an object locally in the call site [...] by implementing something similar to `std::overload`.
Add a Comment
Comments are closed.