reserve std::vector capacity prior oppending + remove const qualifier

This commit is contained in:
artemp 2016-12-20 10:40:50 +01:00
parent 8b049230b3
commit f3cd36f0cd

View file

@ -226,12 +226,15 @@ auto push_geometry = [] (auto const& ctx)
auto push_collection = [] (auto const& ctx) auto push_collection = [] (auto const& ctx)
{ {
auto & dest = _val(ctx); auto & dest = _val(ctx);
auto const& src = _attr(ctx); auto & src = _attr(ctx);
if (dest.empty()) dest = std::move(src); if (dest.empty()) dest = std::move(src);
else else
{
dest.reserve(dest.size() + src.size());
dest.insert(std::end(dest), dest.insert(std::end(dest),
std::make_move_iterator(std::begin(src)), std::make_move_iterator(std::begin(src)),
std::make_move_iterator(std::end(src))); std::make_move_iterator(std::end(src)));
}
}; };