Why doesn't C++11 implicitly convert lambdas to std::function objects?
问题 I implemented a generic event emitter class which allows code to register callbacks, and emit events with arguments. I used Boost.Any type erasure to store the callbacks so they can have arbitrary parameter signatures. It all works, but for some reason, lambdas being passed in must first be turned into std::function objects. Why doesn't the compiler infer that the lambda is the function type? Is it because of the way I use variadic templates? I use Clang (version string: Apple LLVM version 5