summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-01-11 13:57:33 +1100
committerMaxime Coste <mawww@kakoune.org>2018-01-11 13:57:33 +1100
commitbf66302d29c1ca451633e2f18da05583b503a6ca (patch)
treee5a841bb41f3f6608e77c69e05767f6e11296d33 /src
parentc308cddcd8d0fb271eee3d723986da1e18c8edf4 (diff)
Small code style tweak
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 805a4234..c86cc15c 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -1572,13 +1572,10 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
};
if (*bufnames == "*")
{
- // copy buffer list as we might be mutating the buffer list
- // in the loop.
- auto ptrs = BufferManager::instance() |
- transform(std::mem_fn(&std::unique_ptr<Buffer>::get)) |
- filter([](Buffer* buf) { return not (buf->flags() & Buffer::Flags::Debug); });
- Vector<SafePtr<Buffer>> buffers{ptrs.begin(), ptrs.end()};
- for (auto buffer : buffers)
+ for (auto&& buffer : BufferManager::instance()
+ | transform(std::mem_fn(&std::unique_ptr<Buffer>::get))
+ | filter([](Buffer* buf) { return not (buf->flags() & Buffer::Flags::Debug); })
+ | gather<Vector<SafePtr<Buffer>>>()) // gather as we might be mutating the buffer list in the loop.
context_wrap_for_buffer(*buffer);
}
else