Reserve data for # register

This commit is contained in:
Maxime Coste 2018-04-25 08:03:27 +10:00
parent 2fc5a0317c
commit 2d96fbed7c

View File

@ -229,6 +229,7 @@ void register_registers()
register_manager.add_register('#', make_dyn_reg( register_manager.add_register('#', make_dyn_reg(
[](const Context& context) { [](const Context& context) {
StringList res; StringList res;
res.reserve(context.selections().size());
for (size_t i = 1; i < context.selections().size()+1; ++i) for (size_t i = 1; i < context.selections().size()+1; ++i)
res.push_back(to_string((int)i)); res.push_back(to_string((int)i));
return res; return res;