diff options
-rw-r--r-- | drawinglayer/source/primitive2d/baseprimitive2d.cxx | 15 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/baseprimitive2d.hxx | 12 |
2 files changed, 16 insertions, 11 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)); diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx index 850fd2e31b74..c2974215be8d 100644 --- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -58,13 +58,17 @@ namespace drawinglayer { namespace primitive2d { { public: explicit Primitive2DContainer() {} - explicit Primitive2DContainer( size_type count ) : std::vector< Primitive2DReference >(count) {} - Primitive2DContainer( const Primitive2DContainer& other ) : std::vector< Primitive2DReference >(other) {} - Primitive2DContainer( const std::vector< Primitive2DReference >& other ) : std::vector< Primitive2DReference >(other) {} - Primitive2DContainer( std::initializer_list<Primitive2DReference> init ) : std::vector< Primitive2DReference >(init) {} + explicit Primitive2DContainer( size_type count ) : vector(count) {} + Primitive2DContainer( const Primitive2DContainer& other ) : vector(other) {} + Primitive2DContainer( const Primitive2DContainer&& other ) : vector(other) {} + Primitive2DContainer( const vector< Primitive2DReference >& other ) : vector(other) {} + Primitive2DContainer( std::initializer_list<Primitive2DReference> init ) : vector(init) {} void append(const Primitive2DContainer& rSource); void append(const Primitive2DSequence& rSource); + void append(Primitive2DContainer&& rSource); + Primitive2DContainer& operator=(const Primitive2DContainer& r) { vector::operator=(r); return *this; } + Primitive2DContainer& operator=(const Primitive2DContainer&& r) { vector::operator=(r); return *this; } bool operator==(const Primitive2DContainer& rB) const; bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); } basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const; |