« Return to Thread: [Signals2] Signal disconnect wrapper won't work

Re: [Signals2] Signal disconnect wrapper won't work

by Marc DelaCruz :: Rate this Message:

Reply to Author | View in Thread

Doing the following seems to work. I have equivalent slots tied to the
signal and
needed to disconnect only specific ones. I guess I could force a grouping
for each added
slot and disconnect via the grouping.

template<typename T>
void disconnect (void (T::*pMemFunc)(), T* pObj, VoidSignal& rSig)
{
     rSig.disconnect(boost::bind(pMemFunc, pObj));
}

-----Original Message-----
From: boost-users-bounces@...
[mailto:boost-users-bounces@...]On Behalf Of Frank Mori Hess
Sent: Tuesday, July 07, 2009 10:31 AM
To: boost-users@...
Subject: Re: [Boost-users] [Signals2] Signal disconnect wrapper won't
work


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 07 July 2009, Marc DelaCruz wrote:
> So I guess the 'best' workaround would be to do something like below?
>
> template<typename T>
> void disconnect (void (T::*pMemFunc)(void), T& rObj, VoidSignal& rSig)
> {
>     rSig.disconnect(VoidSlot(pMemFunc, rObj));
> }
>

That doesn't look like it would compile.  signals2::slot objects aren't
equality comparable because boost::function objects aren't.  I don't believe
the function objects returned by bind are either.  The best workaround would
be to not use disconnect-by-slot at all and use the connection object
returned by the connect call to disconnect.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpTajsACgkQ5vihyNWuA4X0bgCeKOe4rBBByM5n2/9VB/iJERKc
EdUAn3BT44t4LUZJrAa1gcTY3NlNP33A
=10Wb
-----END PGP SIGNATURE-----
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

 « Return to Thread: [Signals2] Signal disconnect wrapper won't work