diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-23 15:02:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-24 08:43:55 +0200 |
commit | a2fc883173d7053cefe543620982051ae40c4b03 (patch) | |
tree | dac1b760925c8151dfd8a9cbe3a8735b68ab9f79 /drawinglayer | |
parent | 010713e65ccade7b682c219707c8db3d864145c1 (diff) |
use more std::container::insert instead of std::copy
which is both more compact code, and more efficient, since the insert
method can do smarter resizing
Change-Id: I17f226660f87cdf002edccc29b4af8fd59a25f91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96948
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/primitive2d/Primitive2DContainer.cxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx index 8f1e7d31e743..3df6dd791528 100644 --- a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx +++ b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx @@ -111,17 +111,13 @@ void Primitive2DContainer::append(const Primitive2DContainer& rSource) void Primitive2DContainer::append(Primitive2DContainer&& rSource) { - size_t n = size(); - resize(n + rSource.size()); - for (size_t i = 0; i < rSource.size(); ++i) - { - (*this)[n + i] = std::move(rSource[i]); - } + this->insert(this->end(), std::make_move_iterator(rSource.begin()), + std::make_move_iterator(rSource.end())); } void Primitive2DContainer::append(const Primitive2DSequence& rSource) { - std::copy(rSource.begin(), rSource.end(), std::back_inserter(*this)); + this->insert(this->end(), rSource.begin(), rSource.end()); } } // end of namespace drawinglayer::primitive2d |