Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

No more need for signals and slots!

30 views
Skip to first unread message

Mr Flibble

unread,
Aug 13, 2016, 3:59:48 PM8/13/16
to
Hi!

My new GUI library "neoGFX" doesn't use signals and slots as signals and
slots are an old solution to an old problem. Instead all we need to do is:

button1.clicked([](){...});

If you need to unsubscribe from the event (which you should do if any
objects associated with your event handler will be destroyed before the
event source is destroyed) then simply use a "sink" object:

sink s;
s += button1.clicked([](){...});

Here when 's' is destroyed any associated event subscriptions will be
unregistered automatically. A sink can be an object on the stack, a
member variable or a base class.

/Flibble
0 new messages