Implicit conversions with std::function [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicates: Why can't my C++ compiler deduce template argument for boost function? Isn't the template argument (the signature) of std::function part of its type? I have the following: #include <functional> void Foo( std::function<void()> ); void Foo( std::function<void(int)> ); void Bar(); int main() { Foo( Bar ); // Error: ambiguous Foo( [](){} ); // Error: ambiguous Foo( std::function<void()>( Bar ) ); // Ok Foo( std: