Since it lambis a lambda, not a std::function, a temporary std::functionshould be created and passed in bar(). Temporary reference to rvalue link.
Your code is equivalent to this:
auto lamb = [](){};
foo.bar(FunctionType(lamb));
If you do this, you will get a compilation error:
FunctionType func = [](){};
foo.bar(func);
source
share