October 17, 2018 Do D's std.signals check for already-connected slot and simply ignore the call? | ||||
---|---|---|---|---|
| ||||
If they don't, I have to wrap it like so: import std.signals; class Signal(T) { protected: mixin Signal!(T); }; class Changed(T) : Signal!T { protected: void delegate(T)[] slots; public: override void connect(void delegate(T) slot) { foreach (s; slots) { if (s == slot) return; } slots ~= slot; super.connect(slot); } override void disconnect(void delegate(T) slot) { import std.algorithm; foreach (s; slots) { if (s == slot) { slots.remove(s); super.disconnect(slot); break; } } } override void disconnectAll() { super.disconnectAll(); } } ?? |
October 17, 2018 Re: Do D's std.signals check for already-connected slot and simply ignore the call? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Enjoys Math | Answer: they don't connect uniquely, you have to manage that yourself. |
Copyright © 1999-2021 by the D Language Foundation