
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error Can anyone tell me how I disconnect the callback function Hello? I can see in the documentation that I can call disconnect with a group_type and with a slot_type but not with a slot_function_type. I'm surprised to run into such a problem as from the point of view of a library user it can't get much easier than that? Boris PS: This is with Boost 1.33.1.

Boris wrote:
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error
Can anyone tell me how I disconnect the callback function Hello? I can see in the documentation that I can call disconnect with a group_type and with a slot_type but not with a slot_function_type. I'm surprised to run into such a problem as from the point of view of a library user it can't get much easier than that?
Boris
PS: This is with Boost 1.33.1.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Boris, http://www.boost.org/doc/html/signals/tutorial.html#id1627590 -- Regards, dave

On Wed, 06 Jun 2007 23:38:36 +0900, David Klein <dave_chp@gmx.de> wrote:
Boris wrote:
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error [...]Hi Boris,
http://www.boost.org/doc/html/signals/tutorial.html#id1627590
Thanks for the link! But do I really have to collect and maintain various connection objects for a signal? There is out-of-the-box support for attaching callback functions to a signal. But in order to detach them I have to maintain the connection objects for all the callback functions myself? What's the rationale for this? Or is there is any utility class in Boost.Signal I miss? Boris

On Wed, 06 Jun 2007 23:38:36 +0900, David Klein <dave_chp@gmx.de> wrote:
Boris wrote:
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error [...]http://www.boost.org/doc/html/signals/tutorial.html#id1627590
According to http://www.boost.org/doc/html/signals/tutorial.html#id1627841 the code above should work? However I can't compile it with VC++ 2005 SP1. Anyone with the same problem? The error message I get is: error C2664: 'boost::signal0<R,Combiner,Group,GroupCompare,SlotFunction>::disconnect' : cannot convert parameter 1 from 'void (__cdecl *)(void)' to 'const int &' Boris

On Jun 6, 2007, at 11:10 AM, Boris wrote:
On Wed, 06 Jun 2007 23:38:36 +0900, David Klein <dave_chp@gmx.de> wrote:
Boris wrote:
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error [...]http://www.boost.org/doc/html/signals/tutorial.html#id1627590
According to http://www.boost.org/doc/html/signals/ tutorial.html#id1627841 the code above should work? However I can't compile it with VC++ 2005 SP1. Anyone with the same problem? The error message I get is:
The code supporting this feature was accidentally disabled for VC++ in Boost 1.33.1. This oversight was fixed in Boost 1.34.0. - Doug

On Thu, 07 Jun 2007 09:34:32 +0900, Douglas Gregor <doug.gregor@gmail.com> wrote:
[...]
Boris wrote:
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error [...]http://www.boost.org/doc/html/signals/tutorial.html#id1627590
According to http://www.boost.org/doc/html/signals/ tutorial.html#id1627841 the code above should work? However I can't compile it with VC++ 2005 SP1. Anyone with the same problem? The error message I get is:
The code supporting this feature was accidentally disabled for VC++ in Boost 1.33.1. This oversight was fixed in Boost 1.34.0.
Oh, thanks, good to know. Is there anything I can do about it (like setting a preprocessor directive to enable the feature)? Or is it something more difficult to change in the headers? I wonder as while I plan to upgrade to Boost 1.34.0 in the future I'm not yet ready to do so. Boris

Hi Boris, On Jun 7, 2007, at 12:23 AM, Boris wrote:
On Thu, 07 Jun 2007 09:34:32 +0900, Douglas Gregor <doug.gregor@gmail.com> wrote:
The code supporting this feature was accidentally disabled for VC++ in Boost 1.33.1. This oversight was fixed in Boost 1.34.0.
Oh, thanks, good to know. Is there anything I can do about it (like setting a preprocessor directive to enable the feature)? Or is it something more difficult to change in the headers? I wonder as while I plan to upgrade to Boost 1.34.0 in the future I'm not yet ready to do so.
It's actually really easy to fix. If you poke through the headers in boost/function and boost/function/detail, you'll find a couple references to a mysterious constant 0x1700 in some BOOST_WORKAROUND uses... change that to "1300" (decimal, not hex) and it should enable this feature. - Doug

On Jun 7, 2007, at 9:53 PM, Douglas Gregor wrote:
It's actually really easy to fix. If you poke through the headers in boost/function and boost/function/detail, you'll find a couple references to a mysterious constant 0x1700 in some BOOST_WORKAROUND uses... change that to "1300" (decimal, not hex) and it should enable this feature.
Ugh, sorry. "Function" on the brain today... the offending 0x1700 is in boost/signals/signal_template.hpp. - Doug

On Fri, 08 Jun 2007 10:55:39 +0900, Douglas Gregor <doug.gregor@gmail.com> wrote:
On Jun 7, 2007, at 9:53 PM, Douglas Gregor wrote:
It's actually really easy to fix. If you poke through the headers in boost/function and boost/function/detail, you'll find a couple references to a mysterious constant 0x1700 in some BOOST_WORKAROUND uses... change that to "1300" (decimal, not hex) and it should enable this feature.
Ugh, sorry. "Function" on the brain today... the offending 0x1700 is in boost/signals/signal_template.hpp.
Thanks, I found it! As it's a change in a template I suppose I don't need to rebuild the library? Boris

On Jun 8, 2007, at 12:14 AM, Boris wrote:
On Fri, 08 Jun 2007 10:55:39 +0900, Douglas Gregor <doug.gregor@gmail.com> wrote:
On Jun 7, 2007, at 9:53 PM, Douglas Gregor wrote:
It's actually really easy to fix. If you poke through the headers in boost/function and boost/function/detail, you'll find a couple references to a mysterious constant 0x1700 in some BOOST_WORKAROUND uses... change that to "1300" (decimal, not hex) and it should enable this feature.
Ugh, sorry. "Function" on the brain today... the offending 0x1700 is in boost/signals/signal_template.hpp.
Thanks, I found it! As it's a change in a template I suppose I don't need to rebuild the library?
Right, you don't need to rebuild the library. - Doug

On Thu, 07 Jun 2007 09:34:32 +0900, Douglas Gregor <doug.gregor@gmail.com> wrote:
[...]
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error [...]http://www.boost.org/doc/html/signals/tutorial.html#id1627590
According to http://www.boost.org/doc/html/signals/ tutorial.html#id1627841 the code above should work? However I can't compile it with VC++ 2005 SP1. Anyone with the same problem? The error message I get is:
The code supporting this feature was accidentally disabled for VC++ in Boost 1.33.1. This oversight was fixed in Boost 1.34.0.
Doug, I upgraded now to Boost 1.34.0 only to run into another problem with Boost.Signal: C:\Boost\include\boost-1_34\boost/signals/signal_template.hpp(242) : error C2666: 'boost::operator ==' : 4 overloads have similar conversions C:\Boost\include\boost-1_34\boost/function/function_template.hpp(699): could be 'void boost::operator ==<R,T0,Allocator>(const boost::function1<R,T0,Allocator> &,const boost::function1<R,T0,Allocator> &)' [...] C:\Boost\include\boost-1_34\boost/function/function_base.hpp(647): or 'bool boost::operator ==<boost::function<Signature>>(Functor,const boost::function_base &)' [...] C:\Boost\include\boost-1_34\boost/function/function_base.hpp(638): or 'bool boost::operator ==<Function>(const boost::function_base &,Functor)' [...] or 'built-in C++ operator==(void (__thiscall boost::function1<R,T0,Allocator>::dummy::* )(void), void (__thiscall boost::function1<R,T0,Allocator>::dummy::* )(void))' [...] while trying to match the argument list '(boost::function<Signature>, const boost::function<Signature>)' [...] C:\Boost\include\boost-1_34\boost/signals/signal_template.hpp(224) : see reference to function template instantiation 'void boost::signal1<R,T1,Combiner,Group,GroupCompare,SlotFunction>::do_disconnect<T>(const Function &,boost::mpl::bool_<C_>)' being compiled [...] If required I can copy&paste the full error message (I only dropped the template parameters for better readability). Is this a known problem? Anything I can do about it? Boris

On Jul 2, 2007, at 6:57 AM, Boris wrote:
On Thu, 07 Jun 2007 09:34:32 +0900, Douglas Gregor <doug.gregor@gmail.com> wrote:
[...]
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error [...]http://www.boost.org/doc/html/signals/tutorial.html#id1627590
According to http://www.boost.org/doc/html/signals/ tutorial.html#id1627841 the code above should work? However I can't compile it with VC++ 2005 SP1. Anyone with the same problem? The error message I get is:
The code supporting this feature was accidentally disabled for VC++ in Boost 1.33.1. This oversight was fixed in Boost 1.34.0.
Doug, I upgraded now to Boost 1.34.0 only to run into another problem with Boost.Signal:
[snip error]
If required I can copy&paste the full error message (I only dropped the template parameters for better readability). Is this a known problem? Anything I can do about it?
It appears that we're running into a bug in Visual C++ 7.1's handling of partial ordering of function templates. We'll need to find a workaround and put it into Signals itself; I don't think it can be done without changing the Signals library. Could you report this as a bug at http://svn.boost.org/trac/boost/report ? - Doug

On Wed, 04 Jul 2007 00:32:31 +0900, Doug Gregor <dgregor@osl.iu.edu> wrote:
[...]It appears that we're running into a bug in Visual C++ 7.1's handling of partial ordering of function templates. We'll need to find a workaround and put it into Signals itself; I don't think it can be done without changing the Signals library. Could you report this as a bug at http://svn.boost.org/trac/boost/report ?
Done! See http://svn.boost.org/trac/boost/ticket/1076 Boris

On Jun 6, 2007, at 8:46 AM, Boris wrote:
void Hello() { } boost::signal<void ()> sig; sig.connect(&Hello); // OK sig.disconnect(&Hello); // Error
Can anyone tell me how I disconnect the callback function Hello? I can see in the documentation that I can call disconnect with a group_type and with a slot_type but not with a slot_function_type. I'm surprised to run into such a problem as from the point of view of a library user it can't get much easier than that?
Which compiler are you using? Signals should support this syntax, but some compilers can't handle the code for it. - Doug
participants (4)
-
Boris
-
David Klein
-
Doug Gregor
-
Douglas Gregor