Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-05-21 07:14:50

Markus Schöpflin:
> Hello,
> a number of platforms currently fail to compile these tests with an error
> message similar to the following:
> cxx: Error: ../boost/thread/pthread/thread.hpp, line 169: more than one
> instance of overloaded function "boost::bind" matches the
> argument
> list: (ambovlfun)
> function template "boost::bind<R,F,A1>(F, A1)"
> function template "boost::bind(R (T::*)(), A1)"
> The code in question reads:
> template <class F,class A1>
> thread(F f,A1 a1):
> thread_info(make_thread_info(boost::bind<void>(f,a1)))
> {
> start_thread();
> }

The best fix here is probably

    boost::bind( boost::type<void>(), f, a1 )

> 1) make_thread_info(boost::bind(f,a1))

This will fail when f is a function object without a result_type typedef.

> 2) make_thread_info(boost::bind<void>(mem_fn(f),a1))

This will fail when f is not a member pointer.

It seems that these will be exposed by test_thread_launching. It only misses
the cases "ordinary function with arguments" and "member pointer".

The alternative syntax should work in all cases; can you please test it?

Boost list run by bdawes at, gregod at, cpdaniel at, john at