From b7a18a36570994328347e61d9a360152cf82174a Mon Sep 17 00:00:00 2001 From: SUTER Frederic Date: Wed, 12 May 2021 12:07:45 +0200 Subject: [PATCH] accept functions with parameters in Actor::start --- include/simgrid/s4u/Actor.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) { -- 2.20.1