From 4c4eb61c188347f6956dfcd075e190c79f0a970c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 1 Sep 2019 13:03:01 +1000 Subject: Introduce FunctionRef to replace std::function when not storing std::function is not necessary when we just want to pass a type erased callback that does not need to own its target. FunctionRef provides that functionality for a much lower compile time cost. --- src/command_manager.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/command_manager.cc') diff --git a/src/command_manager.cc b/src/command_manager.cc index dcf862ae..294d3eab 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -462,10 +462,9 @@ String expand(StringView str, const Context& context, String expand(StringView str, const Context& context, const ShellContext& shell_context, - const std::function& postprocess) + const FunctionRef& postprocess) { - return expand_impl(str, context, shell_context, - [&](String s) { return postprocess(std::move(s)); }); + return expand_impl(str, context, shell_context, postprocess); } struct command_not_found : runtime_error -- cgit v1.2.3