+ // ***** No copy *****
+
+ Actor(Actor const&) = delete;
+ Actor& operator=(Actor const&) = delete;
+
+ // ***** Reference count (delegated to pimpl_) *****
+
+ friend void intrusive_ptr_add_ref(Actor* actor)
+ {
+ xbt_assert(actor != nullptr);
+ SIMIX_process_ref(actor->pimpl_);
+ }
+ friend void intrusive_ptr_release(Actor* actor)
+ {
+ xbt_assert(actor != nullptr);
+ SIMIX_process_unref(actor->pimpl_);
+ }
+ using Ptr = boost::intrusive_ptr<Actor>;
+
+ // ***** Actor creation *****
+
+ /** Create an actor using a function
+ *
+ * If the actor is restarted, the actor has a fresh copy of the function.
+ */
+ static Ptr createActor(const char* name, s4u::Host *host, double killTime, std::function<void()> code);
+
+ static Ptr createActor(const char* name, s4u::Host *host, std::function<void()> code)
+ {
+ return createActor(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
+ >
+ static Ptr createActor(const char* name, s4u::Host *host, F code, Args... args)
+ {
+ return createActor(name, host, wrap_task(std::move(code), std::move(args)...));
+ }
+
+ // Create actor from function name:
+
+ static Ptr createActor(const char* name, s4u::Host *host, double killTime,
+ const char* function, std::vector<std::string> args);
+
+ static Ptr createActor(const char* name, s4u::Host *host, const char* function,
+ std::vector<std::string> args)
+ {
+ return createActor(name, host, -1.0, function, std::move(args));
+ }
+
+ // ***** Methods *****