summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-12-11 14:59:12 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-12-15 08:17:13 +0000
commit9c9291255f474b396813256050b84ffd425002aa (patch)
tree3d8e2c89debaad8565326cadc179b681bfa5416c /drawinglayer
parent9b9329e479615194dda0288d699263412e5c4f1d (diff)
create a move append method for Primitive2DContainer
since it is fairly common to append temporaries. Change-Id: I920daf8539e42fc9fe313af48fdb34ee4aaf908d Reviewed-on: https://gerrit.libreoffice.org/20637 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/baseprimitive2d.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 1f5e5ddd9f30..795c6098e894 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -312,16 +312,17 @@ namespace drawinglayer
{
insert(end(), rSource.begin(), rSource.end());
}
-/*
+
void Primitive2DContainer::append(Primitive2DContainer&& rSource)
{
- resize(size() + rSource.size());
- memcpy(data() + size(),
- rSource.data(),
- rSource.size() * sizeof(Primitive2DReference));
- memset(reinterpret_cast<void*>(rSource.data()), 0, rSource.size() * sizeof(Primitive2DReference));
+ size_t n = size();
+ resize(n + rSource.size());
+ for (size_t i = 0; i<rSource.size(); ++i)
+ {
+ (*this)[n + i] = std::move( rSource[i] );
+ }
}
-*/
+
void Primitive2DContainer::append(const Primitive2DSequence& rSource)
{
std::copy(rSource.begin(), rSource.end(), std::back_inserter(*this));