digitalmars.D.learn - Do D's std.signals check for already-connected slot and simply ignore
- Enjoys Math (33/33) Oct 16 2018 If they don't, I have to wrap it like so:
- Enjoys Math (2/2) Oct 17 2018 Answer: they don't connect uniquely, you have to manage that
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(); } } ??
Oct 16 2018
Answer: they don't connect uniquely, you have to manage that yourself.
Oct 17 2018