From: Gabriel Corona Date: Mon, 4 Jan 2016 16:36:18 +0000 (+0100) Subject: [simix] Fix forwarding of function in run_kernel X-Git-Tag: v3_13~1356 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/66150cac82e5c723ee69237a008fc27023c73def [simix] Fix forwarding of function in run_kernel --- diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index 8dc10836e1..25d8a917b9 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -28,7 +28,7 @@ template void fulfill_promise(std::promise& promise, F&& code) { try { - promise.set_value(code()); + promise.set_value(std::forward(code)()); } catch(...) { promise.set_exception(std::current_exception()); @@ -41,7 +41,7 @@ template void fulfill_promise(std::promise& promise, F&& code) { try { - code(); + std::forward(code)(); promise.set_value(); } catch(...) { @@ -56,7 +56,7 @@ typename std::result_of::type kernel(F&& code) std::promise promise; simcall_run_kernel([&]{ xbt_assert(SIMIX_is_maestro(), "Not in maestro"); - fulfill_promise(promise, code); + fulfill_promise(promise, std::forward(code)); }); return promise.get_future().get(); }