Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] "std::forward" should only be called on a forwarding reference.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 Dec 2019 21:20:07 +0000 (22:20 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 Dec 2019 21:20:07 +0000 (22:20 +0100)
include/xbt/functional.hpp

index a2ddfa7..1fefcd8 100644 (file)
@@ -192,7 +192,7 @@ private:
   {
     const static TaskVtable vtable {
       // Call:
-      [](TaskUnion& buffer, Args... args) {
+      [](TaskUnion& buffer, Args&&... args) {
         F* src = reinterpret_cast<F*>(&buffer);
         F code = std::move(*src);
         src->~F();
@@ -221,7 +221,7 @@ private:
   {
     const static TaskVtable vtable {
       // Call:
-      [](TaskUnion& buffer, Args... args) {
+      [](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)...);
@@ -244,7 +244,7 @@ public:
   operator bool() const { return vtable_ != nullptr; }
   bool operator!() const { return vtable_ == nullptr; }
 
-  R operator()(Args... args)
+  R operator()(Args&&... args)
   {
     if (vtable_ == nullptr)
       throw std::bad_function_call();