Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
added circle placement for ns3 wifi nodes
[simgrid.git] / include / simgrid / kernel / future.hpp
index 4891f133c30e21ccf44369e4515390bde49d0a58..b41008eb644476de03e700810a921076400f2277 100644 (file)
@@ -48,7 +48,7 @@ public:
   FutureStateBase(FutureStateBase const&) = delete;
   FutureStateBase& operator=(FutureStateBase const&) = delete;
 
-  XBT_PUBLIC void schedule(simgrid::xbt::Task<void()>&& job);
+  XBT_PUBLIC void schedule(simgrid::xbt::Task<void()>&& job) const;
 
   void set_exception(std::exception_ptr exception)
   {
@@ -485,7 +485,7 @@ public:
   }
 
 private:
-  std::shared_ptr<FutureState<T>> state_{new FutureState<T>()};
+  std::shared_ptr<FutureState<T>> state_ = std::make_shared<FutureState<T>>();
   bool future_get_ = false;
 };
 
@@ -522,13 +522,13 @@ public:
     future_get_ = true;
     return Future<void>(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<FutureState<void>> state_{new FutureState<void>()};
+  std::shared_ptr<FutureState<void>> state_ = std::make_shared<FutureState<void>>();
   bool future_get_ = false;
 };