X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/60037b3f9ba9d856ccebf7a2211b51b82f4a557a..6349eaf761d8c7b80db00d48217890c20931964e:/include/xbt/functional.hpp diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index a2ddfa7280..d66763d7d9 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -192,11 +192,11 @@ private: { const static TaskVtable vtable { // Call: - [](TaskUnion& buffer, Args... args) { + [](TaskUnion& buffer, Args&&... args) { F* src = reinterpret_cast(&buffer); F code = std::move(*src); src->~F(); - return code(std::forward(args)...); + return code(std::move(args)...); }, // Destroy: std::is_trivially_destructible::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 code(*reinterpret_cast(&buffer)); - return (*code)(std::forward(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)...); + return vtable->call(buffer_, std::move(args)...); } };