diff options
author | Noel Grandin <noel@peralex.com> | 2016-08-25 15:02:47 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-08-29 09:23:46 +0200 |
commit | 0157009f2293a255e2de682832ef9074924dd4b5 (patch) | |
tree | ba9b684ddba92e43fd23b0cb6bc3596e865c18b7 | |
parent | 05eed2888c8e33257137536453a84f4c458dd249 (diff) |
cid#1371160 Missing move assignment operator
Change-Id: Ifcddd08cd1ec6bfb7679ee0433524c4bd68803dd
-rw-r--r-- | include/tools/fract.hxx | 2 | ||||
-rw-r--r-- | tools/source/generic/fract.cxx | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx index 65110d245388..35790a9fe15e 100644 --- a/include/tools/fract.hxx +++ b/include/tools/fract.hxx @@ -38,6 +38,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Fraction public: Fraction(); Fraction( const Fraction & rFrac ); + Fraction( Fraction && rFrac ); Fraction( long nNum, long nDen=1 ); Fraction( double dVal ); ~Fraction(); @@ -51,6 +52,7 @@ public: operator double() const; Fraction& operator=( const Fraction& rfrFrac ); + Fraction& operator=( Fraction&& rfrFrac ); Fraction& operator+=( const Fraction& rfrFrac ); Fraction& operator-=( const Fraction& rfrFrac ); diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 2a7ad54983eb..c79b24bbf3a3 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -62,6 +62,10 @@ Fraction::Fraction( const Fraction& rFrac ) : mpImpl(new Impl) mpImpl->value.assign( rFrac.mpImpl->value.numerator(), rFrac.mpImpl->value.denominator() ); } +Fraction::Fraction( Fraction&& rFrac ) : mpImpl(std::move(rFrac.mpImpl)) +{ +} + // Initialized by setting nNum as nominator and nDen as denominator // Negative values in the denominator are invalid and cause the // inversion of both nominator and denominator signs @@ -271,6 +275,12 @@ Fraction& Fraction::operator=( const Fraction& rFrac ) return *this; } +Fraction& Fraction::operator=( Fraction&& rFrac ) +{ + mpImpl = std::move(rFrac.mpImpl); + return *this; +} + bool Fraction::IsValid() const { return mpImpl->valid; |