Hi,
I had this situation in a bigger program, where a user could supply a
string or a function object:
<code>
#include
#include <string>
void foo1(int i, std::string a);
void foo1(int i, boost::function foo );
int main(int argc, char** argv)
{
//boost::function foo = "hello"; // this line won't compile
foo1( 3, "hello" ); //error: call of overloaded ‘foo1(int, const
char [6])’ is ambiguous
return 0;
}
</code>
Although constructing a boost::function from a C string is nonsense,
the compiler does consider it as an alternative when trying to find
the right foo1. Is there any work around to keep the overloads without
requiring the user to write
foo1(3, string("hello")); or is this a compiler bug (g++ (Ubuntu
4.3.3-5ubuntu4) 4.3.3)?
Thanks for any insights,
Peter