visiting variants using lambdas - part 1
08 october 2016
While discussing upcoming C++17 features with other attendees at CppCon 2016, I was surprised to hear complaints about the fact that std::variant
visitation requires an external callable object.
Even though std::visit
requires an overloaded callable object as its first argument, it is possible to build such an object locally in the call site: this can easily be achieved by implementing something similar to std::overload
, proposed in P0051R2.
The aforementioned task however becomes trivial when using boost::hana
.