signals disconnect based on equivalent slots

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

signals disconnect based on equivalent slots

James Burgess-2
This works on gcc3.3 and gcc4.0 (OSX) but doesn't compile on vc8.0  
I'm wondering whether it should and I've just messed up somewhere  
installing boost 1.33 or vc8 (VS 2005). I noted that the regression  
test does not perform this form of disconnect, is that the manual  
telling me this isn't supported? I get a very similar error if I try  
a functor (using bind) rather than example below ~ "can't convert to  
'const int'". There's some comments in signal_template.hpp that  
indicate vc 6.0 and 7.0 have problems with this, maybe that #ifdef  
needs to include vc8?

cheers,
- James.

#include <iostream>
#include <boost/signals.hpp>

void rfun()
{
     std::cerr << "Hello World\n";
}

int _tmain(int argc, char* argv[])
{
     boost::signal<void()> sig;
     sig.connect(&rfun);
     sig.disconnect(&rfun);
     return 0;
}

1>------ Build started: Project: testsignals, Configuration: Debug  
Win32 ------
1>Compiling...
1>testsignals.cpp
1>i:\testsignals\testsignals.cpp(19) : error C2664:  
'boost::signal0<R,Combiner,Group,GroupCompare,SlotFunction>::disconnect'
  : cannot convert parameter 1 from 'void (__cdecl *)(void)' to  
'const int &'
1>        with
1>        [
1>            R=void,
1>            Combiner=boost::last_value<void>,
1>            Group=int,
1>            GroupCompare=std::less<int>,
1>            SlotFunction=boost::function<void (void)>
1>        ]
1>        Reason: cannot convert from 'void (__cdecl *)(void)' to  
'const int'
1>        There is no context in which this conversion is possible


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: signals disconnect based on equivalent slots

Peter Dimov
James Burgess wrote:
> This works on gcc3.3 and gcc4.0 (OSX) but doesn't compile on vc8.0
> I'm wondering whether it should and I've just messed up somewhere
> installing boost 1.33 or vc8 (VS 2005). I noted that the regression
> test does not perform this form of disconnect, is that the manual
> telling me this isn't supported? I get a very similar error if I try
> a functor (using bind) rather than example below ~ "can't convert to
> 'const int'". There's some comments in signal_template.hpp that
> indicate vc 6.0 and 7.0 have problems with this, maybe that #ifdef
> needs to include vc8?

The version check in signal_template.hpp is wrong, it says 0x1700 when it
actually seems to mean 1300. VC8 is 1400, so disconnects of this form are
disabled on it. This appears to be a bug and I already reported it on the
developer list.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users