2 ms·
The auto there works like a templated function would (except it's anonymous as you'd expect from a lambda).
by KayEss 8y ago
The auto there works like a templated function would (except it's anonymous as you'd expect from a lambda).
- twoodfin 8y agoI’m still confused. Presumably you can’t pass an uninstantiated template to a function, so what’s the type of the lambda expression? It’s effectively a callable object with multiple overloads but I didn’t know lambda syntax could create something like that.
- KayEss 8y agoLambdas have an un-utterable type, so the addition of a template like mechanism in their arguments is something the compiler can do behind the scenes and it all just works. Look for "generic" in this page <https://en.cppreference.com/w/cpp/language/lambda> https://en.cppreference.com/w/cpp/language/lambda>