This would mean to also commit PR #1600 which is not yet complete and which is reported to require an undesired "templatification". I'm not familiar enough with advanced C++-11 features such as std::forward, std::move, std::function to really evaluate this question.
Thanks, Manolo. #1600 was a test with all what C++11 has to offer. Instead, I'd like to rewrite this with a little less templates and cleaner interface.
std::foward lat's you map one call onto another by forwarding all or part of the function parameters. We have callback(()(Fl_WIdget,void*)), callback(()(Fl_WIdget,long)), callback(std::function<void()>), etc. . By writing Fl::add_timeout(double, std::forward<...>...), C++ automatically writes l::add_timeout(double, ()(Fl_WIdget,void*)) etc. for us.
I made the callback interface not movable and not copiable on purpose to avoid all the issues that arise from managing void*. So no std::move needed. Fl_Widget is not movable or copiable anyway.
std::function is very similar to what the callback macros do: it creates a struct that stores the captured values (to ones between [ and ]), and create the same static callback function that FLTK generally uses. It just does it in the background, keeping code readable. Lambdas are meant to be short (Python lambdas are limited to one function) and just call something more complex in a flexible and readable way.
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/pull/1597/c5569921584@github.com>
Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.