From: SUTER Frederic Date: Wed, 12 May 2021 10:07:45 +0000 (+0200) Subject: accept functions with parameters in Actor::start X-Git-Tag: v3.28~284 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b7a18a36570994328347e61d9a360152cf82174a accept functions with parameters in Actor::start --- diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index f26e7e238e..1d2ac9318f 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -110,6 +110,21 @@ public: /** Start a previously initialized actor */ ActorPtr start(const std::function& code); + template ActorPtr start(F code) { return start(std::function(std::move(code))); } + + template +#endif + > + ActorPtr start(F code, Args... args) + { + return start(std::bind(std::move(code), std::move(args)...)); + } + + ActorPtr start(const std::function& code, std::vector args); + /** Create an actor from a callable thing. */ template static ActorPtr create(const std::string& name, s4u::Host* host, F code) {