From b42071214875fcd7bc356687f3ebe896d83198c5 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 12 Mar 2019 10:20:14 +0100 Subject: [PATCH] References++. --- include/simgrid/kernel/future.hpp | 4 ++-- include/xbt/functional.hpp | 4 ++-- src/s4u/s4u_Mailbox.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 482497a504..b006a5ebe9 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -204,11 +204,11 @@ public: } }; -template void bind_promise(Promise promise, Future future) +template void bind_promise(Promise&& promise, Future future) { class PromiseBinder { public: - explicit PromiseBinder(Promise promise) : promise_(std::move(promise)) {} + explicit PromiseBinder(Promise&& promise) : promise_(std::move(promise)) {} void operator()(Future future) { simgrid::xbt::set_promise(promise_, future); } private: diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 7205ca8777..608d372891 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -32,7 +32,7 @@ private: std::shared_ptr> args_; public: - MainFunction(F code, std::vector args) + MainFunction(F code, std::vector&& args) : code_(std::move(code)), args_(std::make_shared>(std::move(args))) { } @@ -52,7 +52,7 @@ public: } }; -template inline std::function wrap_main(F code, std::vector args) +template inline std::function wrap_main(F code, std::vector&& args) { return MainFunction(std::move(code), std::move(args)); } diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index 52a0874540..604cb6a6b6 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -29,7 +29,7 @@ MailboxPtr Mailbox::by_name(const std::string& name) { kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::by_name_or_null(name); if (mbox == nullptr) { - mbox = simix::simcall([name] { return kernel::activity::MailboxImpl::by_name_or_create(name); }); + mbox = simix::simcall([&name] { return kernel::activity::MailboxImpl::by_name_or_create(name); }); } return MailboxPtr(&mbox->piface_, true); } -- 2.20.1