Unfortunately, they are not part of C++11 (http://ideone.com/NsqYuq):
auto glambda = [](auto a) { return a; };
int main() {}
With g++ 4.7:
prog.cpp:1:24: error: parameter declared ‘auto’
...
However, the way it might be implemented in C++14 as per the Portland proposal for generic lambdas:
[](const& x, & y){ return x + y; }
This would yield for the biggest part the usual creation of an anonymous functor class, but with the lack of types the compiler would emit a templated member-operator()
:
struct anonymous
{
template <typename T, typename U>
auto operator()(T const& x, U& y) const -> decltype(x+y)
{ return x + y; }
};
Or as per the newer proposal Proposal for Generic (Polymorphic) Lambda Expressions
auto L = [](const auto& x, auto& y){ return x + y; };
--->
struct /* anonymous */
{
template <typename T, typename U>
auto operator()(const T& x, U& y) const // N3386 Return type deduction
{ return x + y; }
} L;
So yes, for every permutation of parameters, a new instantiation would arise, however, the members of that functor would still be shared (i.e. the captured arguments).