Hi,
See this code ...
#include<iostream>
#include<boost/bind.hpp>
#include<boost/signal.hpp>
struct CSignal
{
typedef boost::signal< void (void) > UpdateSignal;
UpdateSignal sig;
};
struct CSlot
{:
void update(int i)
{
std::cout << "Call
void update( " << i << " )" <<
std::endl;
}
void connect(CSignal& cs)
{
cs.sig.connect(boost::bind(&CSlot::update, this, 5));
}
void disconnect(CSignal& cs)
{
cs.sig.disconnect(boost::bind(&CSlot::update, this, 5));
}
};
int main()
{
CSignal csignal;
CSlot cslot;
cslot.connect(csignal); csignal.sig();
cslot.disconnect(csignal); csignal.sig();
return (0);
}
When i compile with GCC 4.1.1, this compile fine.
But when i compile with MSVC 2005 it report an error:
.\main.cpp(30) : error C2664:
'boost::signal1<R,T1,Combiner,Group,GroupCompare,SlotFunction>::disconnect'
: cannot convert parameter 1 from 'boost::_bi::bind_t<R,F,L>' to
'const int &'
with
[
R=void,
T1=int,
Combiner=boost::last_value<void>,
Group=int,
GroupCompare=std::less<int>,
SlotFunction=boost::function<void (int)>
]
and
[
R=void,
F=boost::_mfi::mf1<void,CSlot,int>,
L=boost::_bi::list2<boost::_bi::value<CSlot
*>,boost::arg<1>>
]
Reason: cannot convert from 'boost::_bi::bind_t<R,F,L>' to 'const int'
with
[
R=void,
F=boost::_mfi::mf1<void,CSlot,int>,
L=boost::_bi::list2<boost::_bi::value<CSlot
*>,boost::arg<1>>
]
No user-defined-conversion
operator available that can perform this conversion, or the operator
cannot be called
have you any idee to solve this problem?
thank
david callu