Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Install package non-interactively on CI
[simgrid.git] / src / mc / api / strategy / WaitStrategy.hpp
index e2d466b..ed5b9a0 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef SIMGRID_MC_WAITSTRATEGY_HPP
 #define SIMGRID_MC_WAITSTRATEGY_HPP
 
+#include "Strategy.hpp"
 #include "src/mc/transition/Transition.hpp"
 
 namespace simgrid::mc {
@@ -17,7 +18,14 @@ class WaitStrategy : public Strategy {
   bool taking_wait_ = false;
 
 public:
-  void operator=(const WaitStrategy& guide) { taken_wait_ = guide.taken_wait_; }
+  WaitStrategy()                     = default;
+  ~WaitStrategy() override           = default;
+  WaitStrategy(const WaitStrategy&)  = delete;
+  WaitStrategy& operator=(const WaitStrategy& guide)
+  {
+    taken_wait_ = guide.taken_wait_;
+    return *this;
+  }
 
   bool is_transition_wait(Transition::Type type) const
   {
@@ -43,7 +51,7 @@ public:
    *  to decrease the count. */
   void execute_next(aid_t aid, RemoteApp& app) override
   {
-    auto& actor = actors_to_run_.at(aid);
+    auto const& actor = actors_to_run_.at(aid);
     if ((not taking_wait_) and is_transition_wait(actor.get_transition(actor.get_times_considered())->type_)) {
       taken_wait_++;
       taking_wait_ = true;
@@ -58,9 +66,8 @@ public:
 
   void consider_best() override
   {
-    const auto& [aid, _] = this->next_transition();
-    auto actor           = actors_to_run_.find(aid);
-    if (actor != actors_to_run_.end()) {
+    aid_t aid = next_transition().first;
+    if (auto actor = actors_to_run_.find(aid); actor != actors_to_run_.end()) {
       actor->second.mark_todo();
       return;
     }