Familiar template syntax for generic lambdas
The result of a lambda expression is not a function; it is a function object. That is, it is a class type that has an operator()
overload on it. So this:
auto f = []<typename T>( T t ) {};
Is equivalent to this:
struct unnamed
{
template<typename T>
void operator()(T t) {}
};
auto f = unnamed{};
If you want to explicitly provide template arguments to a lambda function, you have to call operator()
explicitly: f.operator()<template arguments>(parameters);
.