summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-30 09:09:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-30 11:13:09 +0200
commit1c7fdf561bc924741a121439a6cb42f96f285b58 (patch)
tree2691b6af91a0256edc71ac038bf226407a57caeb
parentf3fd63d63643b0c8710d80c00a532e97728acb84 (diff)
fix PolyPolygon move operator=
and add move constructor, found by loplugin:noexceptmove Change-Id: I89507113b354c4ae080f7107c996b55ab1285738 Reviewed-on: https://gerrit.libreoffice.org/78285 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/tools/poly.hxx3
-rw-r--r--tools/source/generic/poly2.cxx9
2 files changed, 9 insertions, 3 deletions
diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx
index aed40ece0367..765865b5a228 100644
--- a/include/tools/poly.hxx
+++ b/include/tools/poly.hxx
@@ -197,6 +197,7 @@ public:
PolyPolygon( sal_uInt16 nInitSize = 16 );
PolyPolygon( const tools::Polygon& rPoly );
PolyPolygon( const tools::PolyPolygon& rPolyPoly );
+ PolyPolygon( tools::PolyPolygon&& rPolyPoly ) noexcept;
~PolyPolygon();
void Insert( const tools::Polygon& rPoly, sal_uInt16 nPos = POLYPOLY_APPEND );
@@ -242,7 +243,7 @@ public:
tools::Polygon& operator[]( sal_uInt16 nPos );
tools::PolyPolygon& operator=( const tools::PolyPolygon& rPolyPoly );
- tools::PolyPolygon& operator=( tools::PolyPolygon&& rPolyPoly );
+ tools::PolyPolygon& operator=( tools::PolyPolygon&& rPolyPoly ) noexcept;
bool operator==( const tools::PolyPolygon& rPolyPoly ) const;
bool operator!=( const tools::PolyPolygon& rPolyPoly ) const
{ return !(PolyPolygon::operator==( rPolyPoly )); }
diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 0603a1dc8513..d37ba809f2fb 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -45,6 +45,11 @@ PolyPolygon::PolyPolygon( const tools::PolyPolygon& rPolyPoly )
{
}
+PolyPolygon::PolyPolygon( tools::PolyPolygon&& rPolyPoly ) noexcept
+ : mpImplPolyPolygon( std::move(rPolyPoly.mpImplPolyPolygon) )
+{
+}
+
PolyPolygon::~PolyPolygon()
{
}
@@ -341,9 +346,9 @@ PolyPolygon& PolyPolygon::operator=( const tools::PolyPolygon& rPolyPoly )
return *this;
}
-PolyPolygon& PolyPolygon::operator=( tools::PolyPolygon&& rPolyPoly )
+PolyPolygon& PolyPolygon::operator=( tools::PolyPolygon&& rPolyPoly ) noexcept
{
- mpImplPolyPolygon = rPolyPoly.mpImplPolyPolygon;
+ mpImplPolyPolygon = std::move(rPolyPoly.mpImplPolyPolygon);
return *this;
}