Boost logo

Boost Users :

Subject: Re: [Boost-users] [Signals2] Signal disconnect wrapper won't work
From: Marc DelaCruz (mdelacruz_at_[hidden])
Date: 2009-07-07 12:32:16


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_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]]On Behalf Of Frank Mori Hess
Sent: Tuesday, July 07, 2009 10:31 AM
To: boost-users_at_[hidden]
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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net