Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] This is still ot a forwarding reference.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 22 Dec 2019 15:45:41 +0000 (16:45 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 22 Dec 2019 15:59:37 +0000 (16:59 +0100)
See https://rules.sonarsource.com/cpp/RSPEC-5417 ;
completes commit a96793ec8c496eec19daf68f3aa0c4eded2ea166.

I hope it's correct this time.

include/xbt/functional.hpp

index 1fefcd8..d66763d 100644 (file)
@@ -196,7 +196,7 @@ private:
         F* src = reinterpret_cast<F*>(&buffer);
         F code = std::move(*src);
         src->~F();
         F* src = reinterpret_cast<F*>(&buffer);
         F code = std::move(*src);
         src->~F();
-        return code(std::forward<Args>(args)...);
+        return code(std::move(args)...);
       },
       // Destroy:
       std::is_trivially_destructible<F>::value ?
       },
       // Destroy:
       std::is_trivially_destructible<F>::value ?
@@ -224,7 +224,7 @@ private:
       [](TaskUnion& buffer, Args&&... args) {
         // Delete F when we go out of scope:
         std::unique_ptr<F> code(*reinterpret_cast<F**>(&buffer));
       [](TaskUnion& buffer, Args&&... args) {
         // Delete F when we go out of scope:
         std::unique_ptr<F> code(*reinterpret_cast<F**>(&buffer));
-        return (*code)(std::forward<Args>(args)...);
+        return (*code)(std::move(args)...);
       },
       // Destroy:
       [](TaskUnion& buffer) {
       },
       // Destroy:
       [](TaskUnion& buffer) {
@@ -250,7 +250,7 @@ public:
       throw std::bad_function_call();
     const TaskVtable* vtable = vtable_;
     vtable_ = nullptr;
       throw std::bad_function_call();
     const TaskVtable* vtable = vtable_;
     vtable_ = nullptr;
-    return vtable->call(buffer_, std::forward<Args>(args)...);
+    return vtable->call(buffer_, std::move(args)...);
   }
 };
 
   }
 };