+ Actor() : pimpl_(nullptr) {}
+ Actor(smx_process_t smx_proc) :
+ pimpl_(SIMIX_process_ref(smx_proc)) {}
+ ~Actor()
+ {
+ SIMIX_process_unref(pimpl_);
+ }
+
+ // Copy+move (with the copy-and-swap idiom):
+ Actor(Actor const& actor) : pimpl_(SIMIX_process_ref(actor.pimpl_)) {}
+ friend void swap(Actor& first, Actor& second)
+ {
+ using std::swap;
+ swap(first.pimpl_, second.pimpl_);
+ }
+ Actor& operator=(Actor actor)
+ {
+ swap(*this, actor);
+ return *this;
+ }
+ Actor(Actor&& actor) : pimpl_(nullptr)
+ {
+ swap(*this, actor);
+ }
+
+ /** Create an actor using a function
+ *
+ * If the actor is restarted, the actor has a fresh copy of the function.
+ */
+ Actor(const char* name, s4u::Host *host, double killTime, std::function<void()> code);
+
+ Actor(const char* name, s4u::Host *host, std::function<void()> code)
+ : Actor(name, host, -1.0, std::move(code)) {};
+
+ /** Create an actor using code
+ *
+ * Using this constructor, move-only type can be used. The consequence is
+ * that we cannot copy the value and restart the process in its initial
+ * state. In order to use auto-restart, an explicit `function` must be passed
+ * instead.
+ */
+ template<class F, class... Args,
+ // This constructor is enabled only if the call code(args...) is valid:
+ typename = typename std::result_of<F(Args...)>::type
+ >
+ Actor(const char* name, s4u::Host *host, F code, Args... args) :
+ Actor(name, host, wrap_task(std::move(code), std::move(args)...))
+ {}
+
+ // Create actor from function name:
+
+ Actor(const char* name, s4u::Host *host, double killTime,
+ const char* function, std::vector<std::string> args);