I have a class called ByteSink that has a move constructor and move assignment operator. I pass an object of type ByteSink into bood::bind() by-value and it fails to compile. First, here is my call to boost::bind():
void SerialClient::Write( ByteSink data )
{
m_service.post( boost::bind( &SerialClient::DoWrite, this, data ) );
}
The error message I'm getting will be located at the very bottom of this message to prevent clutter. Note that I am compiling on MSVC9 under Windows. Below is what my move constructor/assignment function prototypes look like for ByteSink:
/// Uses move semantics.
ByteSink( ByteSink& other );
/// Uses move semantics.
ByteSink& operator= ( ByteSink& other );
And the compiler error I'm getting (It's a bit lengthy) is below. Any idea what is causing this? My best guess is that boost::bind() is using const somewhere, and it cannot find a copy constructor that takes a const ByteSink as a parameter, since I'm not using a typical copy constructor.
1>C:\IT\third_party\boost_1_40_0_beta1\boost/bind/bind.hpp(859) : error C2558: class 'boost::_bi::list2<A1,A2>' : no copy constructor available or copy constructor is declared 'explicit'
1> with
1> [
1> A1=boost::_bi::value<SerialClient *>,
1> A2=boost::_bi::value<ByteSink>
1> ]
1> C:\IT\third_party\boost_1_40_0_beta1\boost/bind/bind.hpp(859) : while compiling class template member function 'boost::_bi::bind_t<R,F,L>::bind_t(F,const L &)'
1> with
1> [
1> R=void,
1> F=boost::_mfi::mf1<void,SerialClient,ByteSink>,
1> L=boost::_bi::list2<boost::_bi::value<SerialClient *>,boost::_bi::value<ByteSink>>
1> ]
1> ..\SerialClient.cpp(32) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
1> with
1> [
1> R=void,
1> F=boost::_mfi::mf1<void,SerialClient,ByteSink>,
1> L=boost::_bi::list2<boost::_bi::value<SerialClient *>,boost::_bi::value<ByteSink>>
1> ]