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/line_modification.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/line_modification.cc')
| -rw-r--r-- | src/line_modification.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/line_modification.cc b/src/line_modification.cc index d052cb54..01ad22bf 100644 --- a/src/line_modification.cc +++ b/src/line_modification.cc @@ -145,7 +145,7 @@ void LineRangeSet::update(ConstArrayView<LineModification> modifs) erase(std::remove_if(begin(), end(), [](auto& r) { return r.begin >= r.end; }), end()); } -void LineRangeSet::add_range(LineRange range, std::function<void (LineRange)> on_new_range) +void LineRangeSet::add_range(LineRange range, FunctionRef<void (LineRange)> on_new_range) { auto it = std::lower_bound(begin(), end(), range.begin, [](LineRange range, LineCount line) { return range.end < line; }); |
