[Signals] Added disconnect() based on function object equivalence

Since we're discussing the issue, I've added an experimental disconnect() member function to signals that allows one to disconnect equivalent slots, e.g., void foo(); void bar(); signal<void()> sig; sig.connect(&foo); sig.connect(&bar); sig.disconnect(&foo); // disconnects foo, but not bar We could also reconsider the += and -= syntax, since support for -= now makes some sense. Doug

Douglas Gregor wrote:
Since we're discussing the issue, I've added an experimental disconnect() member function to signals that allows one to disconnect equivalent slots, e.g.,
void foo(); void bar();
signal<void()> sig;
sig.connect(&foo); sig.connect(&bar);
sig.disconnect(&foo); // disconnects foo, but not bar
Glad to see it.
We could also reconsider the += and -= syntax, since support for -= now makes some sense.
.NET delegates, which are equivalent to boost signals in .NET-land, uses the += and -= operates to add and remove event handlers. But I am sure you know that already <g> .
participants (2)
-
Douglas Gregor
-
Edward Diener