Consider the overloaded functions foo and bar:
typedef boost::function function_type1;
typedef boost::function function_type2;
typedef std::function function_type3;
typedef std::function 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(&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?