Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2008-05-21 05:20:35


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):

and it is used like this (in test_lock_concept.cpp):

struct ...
     void locking_thread()


     void operator()()
         boost::thread t(&this_type::locking_thread,this);

Looking at the bind documentation, the syntax for using bind with pointers
to members is either

   bind(&X::f, args)


   bind<R>(mem_fn(&X::f), args)

So there are three possible fixes:

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

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

3) boost::thread t(mem_fn(&this_type::locking_thread),this);

Every one of those makes the compile error go away. Option 1) might be the
most flexible, 2) is probably too restrictive, and 3) is the least
intrusive, as it only modifies the tests.

Would the thread maintainer please decide on a fix and then commit it?

Best regards,

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