# HG changeset patch # User John W. Eaton # Date 1560964335 18000 # Node ID 0ad2ff3a3a6e6fd81b598fb74e95ade838a505ce # Parent 8ebe70b98e978817c08bbdcffd7119bae1452ef8 allow lambda expressions to be passed to octave_link::post_event * octave-link.h (octave_link::post_event, octave_link::do_post_event): New overloads that can accept std::function and arguments. diff -r 8ebe70b98e97 -r 0ad2ff3a3a6e libinterp/corefcn/octave-link.h --- a/libinterp/corefcn/octave-link.h Mon Jun 17 11:12:52 2019 -0500 +++ b/libinterp/corefcn/octave-link.h Wed Jun 19 12:12:15 2019 -0500 @@ -104,6 +104,14 @@ return retval; } + template + static void + post_event (F&& fcn, Args&&... args) + { + if (enabled ()) + instance->do_post_event (fcn, std::forward (args)...); + } + template static void post_event (T *obj, void (T::*method) (Params...), Args&&... args) @@ -465,6 +473,12 @@ void do_process_events (void); void do_discard_events (void); + template + void do_post_event (F&& fcn, Args&&... args) + { + gui_event_queue.add (fcn, std::forward (args)...); + } + template void do_post_event (T *obj, void (T::*method) (Params...), Args&&... args) {