Do C++14 generic lambdas bring a real improvement to the language or they are a kind of syntactic sugar? Whether there are some situations where
[](auto param1, auto param2, /* ... */ auto paramN)
{
return /* ... */;
}
cannot be replaced with
template <typename Type1, typename Type2, /* ... */ typename TypeN>
auto foo(Type1&& param1, Type2&& param2, /* ... */ TypeN&& paramN)
{
return /* ... */;
}
or
struct bar
{
template <typename Type1, typename Type2, /* ... */ typename TypeN>
auto operator()(Type1&& param1, Type2&& param2, /* ... */ TypeN&& paramN)
{
return /* ... */;
}
};
?
@Kerrek SB provided very interesting links in the comments which illustrate the power of generic lambdas:
Boost.Hana: Heterogeneous combinators for expressive metaprogramming (github)