Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Pass the code by reference in simcall_run_kernel
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 3 Jun 2016 11:00:48 +0000 (13:00 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 3 Jun 2016 11:00:48 +0000 (13:00 +0200)
Avoid heap-allocating code for std::function.

include/simgrid/simix.hpp

index 1f88d97..901081a 100644 (file)
 
 XBT_PUBLIC(void) simcall_run_kernel(std::function<void()> const& code);
 
+template<class F> inline
+void simcall_run_kernel(F& f)
+{
+  simcall_run_kernel(std::function<void()>(std::ref(f)));
+}
+
 namespace simgrid {
 namespace simix {