Small code style tweak

This commit is contained in:
Maxime Coste 2018-01-11 13:57:33 +11:00
parent c308cddcd8
commit bf66302d29

View File

@ -1572,13 +1572,10 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
}; };
if (*bufnames == "*") if (*bufnames == "*")
{ {
// copy buffer list as we might be mutating the buffer list for (auto&& buffer : BufferManager::instance()
// in the loop. | transform(std::mem_fn(&std::unique_ptr<Buffer>::get))
auto ptrs = BufferManager::instance() | | filter([](Buffer* buf) { return not (buf->flags() & Buffer::Flags::Debug); })
transform(std::mem_fn(&std::unique_ptr<Buffer>::get)) | | gather<Vector<SafePtr<Buffer>>>()) // gather as we might be mutating the buffer list in the loop.
filter([](Buffer* buf) { return not (buf->flags() & Buffer::Flags::Debug); });
Vector<SafePtr<Buffer>> buffers{ptrs.begin(), ptrs.end()};
for (auto buffer : buffers)
context_wrap_for_buffer(*buffer); context_wrap_for_buffer(*buffer);
} }
else else