Boost logo

Boost Users :

From: Misza (Misza.B_at_[hidden])
Date: 2005-06-26 08:43:55


Jason wrote:

> int x = 99;
> boost::thread thrd1(boost::bind<void>(&sender, _1)(x));
>
> and several other combinations including removal of <void>. In the above case,
> gcc results in
> /mnt/shared/Projects/boosttest/src/bounded_buffer.cpp:77: error: call of
> overloaded `bind(void (*)(int), boost::arg<1>&)' is ambiguous
> /usr/include/boost/bind.hpp:1132: note: candidates are: boost::_bi::bind_t<R, F,
> typename boost::_bi::list_av_1<A1>::type> boost::bind(F, A1) [with R = void, F =
> void (*)(int), A1 = boost::arg<1>]

I am having a very similar (I think) problem.

Namely, I'm playing with the Spirit library. I started with
the comma-separated-real-number-parser from the examples
but wanted to use my own semantic action:

void F (vector<double> &v, double x) {
   v.push_back(x);
}

the core function is:

bool parse_numbers(char const* str, vector<double> &v) {
   return parse(str,
     real_p[bind<void>(&F,v,_1)] >>
     *(',' >> real_p[bind<void>(&F,v,_1)]),
     space_p).full;
}

on both lines with "bind" I get:

test.cpp: In function `<snip>':
test.cpp:19: error: call of overloaded `<snip - very long>' is ambiguous
/usr/include/boost/bind/bind_cc.hpp:37: error: candidates are:
    <snip1>
/usr/include/boost/bind.hpp:1190: error:
    <snip2>

where <snip1> and <snip2> were indeed identical types.

I also tried without <void> but then I get some return value errors.

So, what am I doing wrong?

thanks,
     Misza


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