
Consider the overloaded functions foo and bar: typedef boost::function<void(void)> function_type1; typedef boost::function<void(int)> function_type2; typedef std::function<void(void)> function_type3; typedef std::function<void(int)> function_type4; void foo(const function_type1 &a) { // blah } void foo(const function_type2 &a) { // blah } void bar(const function_type3 &a) { // blah } void bar(const function_type4 &a) { // blah } calling foo with a function pointer is ambiguous, but calling bar is not: void doit1(void) {} void doit2(int) {} foo(&doit1); // ambiguous bar(&doit2); // compiles and runs fine This occurs despite the fact that boost::function<void(void)>(&doit2) can be caught at compile time. Is there some way to fix the definition of boost::function such that this is no longer ambiguous?