Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Use std::move with rvalue references.
[simgrid.git] / include / simgrid / simix / blocking_simcall.hpp
index e43affe..973ead8 100644 (file)
@@ -57,7 +57,7 @@ template <class F> auto kernel_sync(F code) -> decltype(code().get())
         try {
           auto future = code();
           future.then_([&result, self](std::shared_ptr<simgrid::kernel::FutureState<T>>&& value) {
-            simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(value));
+            simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(std::move(value)));
             simgrid::simix::unblock(self);
           });
         } catch (...) {
@@ -94,7 +94,7 @@ public:
             // When the kernel future is ready...
             this->future_.then_([&result, self](std::shared_ptr<simgrid::kernel::FutureState<T>>&& value) {
               // ... wake up the process with the result of the kernel future.
-              simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(value));
+              simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(std::move(value)));
               simgrid::simix::unblock(self);
             });
           } catch (...) {
@@ -125,7 +125,7 @@ public:
             // When the kernel future is ready...
             this->future_.then_([this, self](std::shared_ptr<simgrid::kernel::FutureState<T>>&& value) {
               // ...store it the simix kernel and wake up.
-              this->future_ = std::move(simgrid::kernel::Future<T>(value));
+              this->future_ = simgrid::kernel::Future<T>(std::move(value));
               simgrid::simix::unblock(self);
             });
           } catch (...) {