From 6d7c8b38a6c1ed33b29a5ef2fc3cd120c26e0819 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 7 Dec 2017 15:11:00 +0100 Subject: [PATCH] Add explicit keyword to simgrid::xbt::Task constructor. --- include/xbt/functional.hpp | 9 ++------- src/simix/smx_global.cpp | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index dde3b7e60b..fcec55929f 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -255,12 +255,7 @@ private: } public: - - template - Task(F code) - { - this->init(std::move(code)); - } + template explicit Task(F code) { this->init(std::move(code)); } operator bool() const { return vtable_ != nullptr; } bool operator!() const { return vtable_ == nullptr; } @@ -297,7 +292,7 @@ auto makeTask(F code, Args... args) -> Task< decltype(code(std::move(args)...))() > { TaskImpl task(std::move(code), std::make_tuple(std::move(args)...)); - return std::move(task); + return Task(std::move(task)); } } diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index fb5a7c54b5..e5a9826691 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -570,7 +570,7 @@ void SIMIX_run() */ smx_timer_t SIMIX_timer_set(double date, void (*callback)(void*), void *arg) { - smx_timer_t timer = new s_smx_timer_t(date, [callback, arg]() { callback(arg); }); + smx_timer_t timer = new s_smx_timer_t(date, simgrid::xbt::makeTask([callback, arg]() { callback(arg); })); timer->handle_ = simix_timers.emplace(std::make_pair(date, timer)); return timer; } -- 2.20.1