c++ - Why can't the compiler resolve an overload of a std::function parameter? -
this question has answer here: wrap overloaded function via std::function 1 answer observe following example: #include <iostream> #include <functional> #include <cstdlib> void print_wrapper(std::function<void(int)> function); void print(int param); int main(){ print_wrapper(print); return exit_success; } void print_wrapper(std::function<void(int)> function){ int = 5; function(i); } void print(int param){ std::cout << param << std::endl; } this works correctly, , prints 5 . now @ same example overloaded function added: #include <iostream> #include <functional> #include <cstdlib> void print_wrapper(std::function<void(int)> function); void print(int param); void print(float param); int main(){ print_wrapper(print); return exit_success; } void print_wrapper(std::functio