summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-03-29 15:36:39 -0700
committerWilliam A. Kennington III <wak@google.com>2019-03-29 15:45:51 -0700
commit8eaf5fcc598df14c8956c5afe657f51e683074ef (patch)
tree339cbd4f5bf2433c573f99de687670066a9f3099 /src
parent2584f9d7b91e2d14ddc9bdcb45fc5133a083b522 (diff)
downloadsdeventplus-8eaf5fcc598df14c8956c5afe657f51e683074ef.tar.gz
sdeventplus-8eaf5fcc598df14c8956c5afe657f51e683074ef.zip
internal/utils: performCallback should preserve argument references
Arguments including the function are now passed with reference types forwarded. Change-Id: I32cf4704737faa6c140d16352528ceb0d738f5b8 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/sdeventplus/internal/utils.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sdeventplus/internal/utils.hpp b/src/sdeventplus/internal/utils.hpp
index 193a52c..9d612e5 100644
--- a/src/sdeventplus/internal/utils.hpp
+++ b/src/sdeventplus/internal/utils.hpp
@@ -4,6 +4,7 @@
#include <chrono>
#include <cstdio>
#include <exception>
+#include <functional>
#include <sdeventplus/exception.hpp>
#include <stdexcept>
#include <stdplus/util/cexec.hpp>
@@ -23,12 +24,12 @@ namespace internal
* @details A generic wrapper that turns exceptions into
* error messages and return codes.
*/
-template <typename Func, typename... Args>
-inline int performCallback(const char* name, Func func, Args... args)
+template <typename... Args>
+inline int performCallback(const char* name, Args&&... args)
{
try
{
- func(args...);
+ std::invoke(std::forward<Args>(args)...);
return 0;
}
catch (const std::system_error& e)
OpenPOWER on IntegriCloud