diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-09-01 13:03:01 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-09-01 13:04:47 +1000 |
| commit | 4c4eb61c188347f6956dfcd075e190c79f0a970c (patch) | |
| tree | 4a39400d0dc21244066c77ab07d930848beeed04 /src/command_manager.cc | |
| parent | b24be99fa3e684201faed534c5988940d561df35 (diff) | |
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.
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 5 |
1 files changed, 2 insertions, 3 deletions
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<String (String)>& postprocess) + const FunctionRef<String (String)>& 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 |
