[boost::signal][boost::bind] signal::disconnect problem with MSVC 2005

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

david callu wrote:
When i compile with GCC 4.1.1, this compile fine. But when i compile with MSVC 2005 it report an error:
[...] This looks like a bug in Boost.Signals. At signal_template.hpp:213, replace: #if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1700) with #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) and see if it helps.

Thank you very much Peter. This fix the problem. Now, all compile fine with MSVC 2005 Cheer David Callu 2006/9/21, Peter Dimov <pdimov@mmltd.net>:
david callu wrote:
When i compile with GCC 4.1.1, this compile fine. But when i compile with MSVC 2005 it report an error:
[...]
This looks like a bug in Boost.Signals. At signal_template.hpp:213, replace:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1700)
with
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
and see if it helps.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Thanks David and Peter. I've put this fix into Boost CVS for future releases. Doug On Sep 21, 2006, at 2:06 PM, david callu wrote:
Thank you very much Peter. This fix the problem. Now, all compile fine with MSVC 2005
Cheer
David Callu
2006/9/21, Peter Dimov <pdimov@mmltd.net>: david callu wrote:
When i compile with GCC 4.1.1, this compile fine. But when i compile with MSVC 2005 it report an error:
[...]
This looks like a bug in Boost.Signals. At signal_template.hpp:213, replace:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1700)
with
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
and see if it helps.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Doug Gregor wrote:
Thanks David and Peter. I've put this fix into Boost CVS for future releases.
FWIW, it looks like the same erroneous version check is present in deletion_test.cpp; maybe that's why this bug has went unnoticed. I prefer to just let tests fail instead of #ifdef-ing them for this very reason. :-)
participants (3)
-
david callu
-
Doug Gregor
-
Peter Dimov