18 Nov
2014
18 Nov
'14
10:52 p.m.
On 18 Nov 2014, at 22:59, Antony Polukhin
2014-11-19 0:40 GMT+03:00 Nevin Liber
: It's the inversion of control that people just don't like.
As a guy, who's been keeping an eye on Boost.Variant for last two years, I was planning to add support for generalized lambdas as a visitors for variant:
apply_visitor( [](auto v){ std::cout << v; }, variant_variable );
Alternatively, it could be done like this: apply_visitor(variant_variable, [](int i) { std::cout << “int: “ << i; }, [](float f) { std::cout << “float: “ << f; }, otherwise([](auto v) { std::cout << “something: “ << v; }); I’ve recently written something very similar for boost::any, using runtime checks instead of course. Sebastian