Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::function unusable as overloadable function argument
From: Nat Goodspeed (nat_at_[hidden])
Date: 2009-08-28 12:08:42


Peter Soetens wrote:

> void foo1(int i, std::string a);
> void foo1(int i, boost::function<void(void)> foo );
>
> int main(int argc, char** argv)
> {
> //boost::function<void(void)> foo = "hello"; // this line won't compile
>
> foo1( 3, "hello" ); //error: call of overloaded ‘foo1(int, const
> char [6])’ is ambiguous
>
> return 0;
> }

When I've encountered that, I've sometimes defined an additional overload:

void fool(int i, const char* a) { fool(i, std::string(a)); }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net