]> AND Public Git Repository - simgrid.git/blobdiff - include/simgrid/simix.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Release v3.26
[simgrid.git] / include / simgrid / simix.hpp
index 115fdff27c6cbae415b39fd3f923f631c4a8a602..5f61cb108008b84a4d5f96b0599d792fc3a2b8d8 100644 (file)
@@ -11,6 +11,7 @@
 #include <xbt/functional.hpp>
 #include <xbt/future.hpp>
 #include <xbt/signal.hpp>
+#include <xbt/utility.hpp>
 
 #include <boost/heap/fibonacci_heap.hpp>
 #include <string>
@@ -52,7 +53,7 @@ template <class F> typename std::result_of<F()>::type simcall(F&& code, mc::Simc
   // If we are in the application, pass the code to the maestro which
   // executes it for us and reports the result. We use a std::future which
   // conveniently handles the success/failure value for us.
-  typedef typename std::result_of<F()>::type R;
+  using R = typename std::result_of<F()>::type;
   simgrid::xbt::Result<R> result;
   simcall_run_kernel([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward<F>(code)); }, t);
   return result.get();
@@ -95,8 +96,7 @@ template <class R, class F> R simcall_blocking(F&& code, mc::SimcallInspector* t
 namespace simgrid {
 namespace simix {
 
-
-typedef std::pair<double, Timer*> TimerQelt;
+using TimerQelt = std::pair<double, Timer*>;
 static boost::heap::fibonacci_heap<TimerQelt, boost::heap::compare<xbt::HeapComparator<TimerQelt>>> simix_timers;
 
 /** @brief Timer datatype */
@@ -109,7 +109,7 @@ public:
   Timer(double date, simgrid::xbt::Task<void()>&& callback) : date(date), callback(std::move(callback)) {}
 
   simgrid::xbt::Task<void()> callback;
-  double get_date() { return date; }
+  double get_date() const { return date; }
   void remove();
 
   template <class F> static inline Timer* set(double date, F callback)