|
Boost Users : |
From: Jason (bongo_at_[hidden])
Date: 2005-06-24 01:27:21
I'm trying to use bind with boost.thread in order to make a thread of a class
member function with an input argument, but I can't get it to compile. To narrow
the problem, I went to the bounded_buffer.cpp program in the
libs/thread/tutorial dir. I added an int arg to sender, and then changed
boost::thread thrd1(&sender);
to
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 got this syntax from the bind doc (http://www.boost.org/libs/bind/bind.html).
What am I doing wrong?
thanks,
Jason
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