X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/46b5ad533f43c3bd728fd9f824cfedb0bdc51852..4b0fa756ae6e58a74c374a519389ecb9e8b6a4d9:/include/simgrid/kernel/future.hpp diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 4891f133c3..b41008eb64 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -48,7 +48,7 @@ public: FutureStateBase(FutureStateBase const&) = delete; FutureStateBase& operator=(FutureStateBase const&) = delete; - XBT_PUBLIC void schedule(simgrid::xbt::Task&& job); + XBT_PUBLIC void schedule(simgrid::xbt::Task&& job) const; void set_exception(std::exception_ptr exception) { @@ -485,7 +485,7 @@ public: } private: - std::shared_ptr> state_{new FutureState()}; + std::shared_ptr> state_ = std::make_shared>(); bool future_get_ = false; }; @@ -522,13 +522,13 @@ public: future_get_ = true; return Future(state_); } - void set_value() + void set_value() const { if (state_ == nullptr) throw std::future_error(std::future_errc::no_state); state_->set_value(); } - void set_exception(std::exception_ptr exception) + void set_exception(std::exception_ptr exception) const { if (state_ == nullptr) throw std::future_error(std::future_errc::no_state); @@ -536,7 +536,7 @@ public: } private: - std::shared_ptr> state_{new FutureState()}; + std::shared_ptr> state_ = std::make_shared>(); bool future_get_ = false; };