Mercurial > octave
changeset 27191:0ad2ff3a3a6e
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.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 19 Jun 2019 12:12:15 -0500 |
parents | 8ebe70b98e97 |
children | 8779c631d55f |
files | libinterp/corefcn/octave-link.h |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <typename F, typename... Args> + static void + post_event (F&& fcn, Args&&... args) + { + if (enabled ()) + instance->do_post_event (fcn, std::forward<Args> (args)...); + } + template <typename T, typename... Params, typename... Args> 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 <typename F, typename... Args> + void do_post_event (F&& fcn, Args&&... args) + { + gui_event_queue.add (fcn, std::forward<Args> (args)...); + } + template <typename T, typename... Params, typename... Args> void do_post_event (T *obj, void (T::*method) (Params...), Args&&... args) {