Hi:

I’m trying to store a boost.thread in a boost::fusion::vector, and need to use a shared ptr, due to boost.thrad being non-copyable

I’m using Microsoft visual c++ 2010.

 

I get the following error:

     1>d:\devexpress\mdrlite\mdrlite\mdrlite\midiwidget.cpp(21): error C2664: 'boost::shared_ptr<T>::shared_ptr(boost::shared_ptr<T> &&)' : cannot convert parameter 1 from 'boost::_bi::bind_t<R,F,L>' to 'boost::shared_ptr<T> &&'

                 with

                 [

                     T=boost::thread

                 ]

                 and

                 [

                     R=size_t,

                     F=boost::_mfi::mf0<size_t,boost::asio::io_service>,

                     L=boost::_bi::list1<boost::_bi::value<boost::asio::io_service *>>

                 ]

                 and

                 [

                     T=boost::thread

                 ]

                 Reason: cannot convert from 'boost::_bi::bind_t<R,F,L>' to 'boost::shared_ptr<T>'

                 with

                 [

                     R=size_t,

                     F=boost::_mfi::mf0<size_t,boost::asio::io_service>,

                     L=boost::_bi::list1<boost::_bi::value<boost::asio::io_service *>>

                 ]

                 and

                 [

                     T=boost::thread

                 ]

                 No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

My boost thread is defined as:

boost::thread t(boost::bind(&boost::asio::io_service::run, io.get()));

and io is defined as:

boost::shared_ptr<boost::asio::io_service> io;

I’m obviously overlooking something, I just carn’t work out what?

Any help appreciated.

Regards

Sean.