Boost logo

Boost Users :

From: Mike Feldmeier (pooky_bunny_at_[hidden])
Date: 2004-06-02 12:53:31


Hi everyone,

Could someone please point me in the right direction with this one? :

class data
{
   int x;
};

class worker
{
   void run(&data d);
};

void run_worker(worker& w, data& d)
{
   boost::thread(boost::bind(&worker::run, &my_worker,
_1)(boost:ref(my_data)));
}

void main()
{
   worker my_worker;
   data my_data;

   run_worker(my_worker, my_data);
}

Compiling this yields..

test.cpp(24) : error C2440: 'type cast' : cannot convert from
'boost::_bi::bind_t<R,F,L>::result_type' to 'boost::thread'
        with
        [
            R=void,
            F=boost::_mfi::mf1<void,worker,data &>,
            L=boost::_bi::list2<boost::_bi::list_av_2<worker
*,boost::arg<1>>::B1,boost::_bi::list_av_2<worker *,boost::arg<1>>::B2>
        ]
        Expressions of type void cannot be converted to other types

Can I not bind to functions with a void return type? Changing it to int,
produces a similar message.

Any help appreciated!

Thanks,
Mike

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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