From 97de6bf69a368f677e8324ec6d34106cf632d6dc Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 3 Jun 2016 13:00:48 +0200 Subject: [PATCH] [simix] Pass the code by reference in simcall_run_kernel Avoid heap-allocating code for std::function. --- include/simgrid/simix.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index 1f88d9730b..901081aa1b 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -24,6 +24,12 @@ XBT_PUBLIC(void) simcall_run_kernel(std::function const& code); +template inline +void simcall_run_kernel(F& f) +{ + simcall_run_kernel(std::function(std::ref(f))); +} + namespace simgrid { namespace simix { -- 2.20.1