Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] This is still ot a forwarding reference.
[simgrid.git] / include / xbt / functional.hpp
index a2ddfa7..d66763d 100644 (file)
@@ -192,11 +192,11 @@ 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();
-        return code(std::forward<Args>(args)...);
+        return code(std::move(args)...);
       },
       // Destroy:
       std::is_trivially_destructible<F>::value ?
@@ -221,10 +221,10 @@ 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)...);
+        return (*code)(std::move(args)...);
       },
       // Destroy:
       [](TaskUnion& buffer) {
@@ -244,13 +244,13 @@ 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();
     const TaskVtable* vtable = vtable_;
     vtable_ = nullptr;
-    return vtable->call(buffer_, std::forward<Args>(args)...);
+    return vtable->call(buffer_, std::move(args)...);
   }
 };