Fix move semantic.

New class.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-12-30 14:48:27 +02:00
parent 74bb3e4369
commit 54cb9fe0fb
2 changed files with 17 additions and 3 deletions

View file

@ -71,6 +71,21 @@ VBestSquare &VBestSquare::operator=(const VBestSquare &res)
return *this;
}
#ifdef Q_COMPILER_RVALUE_REFS
//---------------------------------------------------------------------------------------------------------------------
VBestSquare &VBestSquare::operator=(VBestSquare &&res) Q_DECL_NOTHROW
{
Swap(res);
return *this;
}
#endif
//---------------------------------------------------------------------------------------------------------------------
void VBestSquare::Swap(VBestSquare &res) Q_DECL_NOTHROW
{
std::swap(d, res.d);
}
//---------------------------------------------------------------------------------------------------------------------
void VBestSquare::NewResult(const VBestSquareResData &data)
{

View file

@ -49,11 +49,10 @@ public:
VBestSquare &operator=(const VBestSquare &res);
#ifdef Q_COMPILER_RVALUE_REFS
VBestSquare &operator=(VBestSquare &&res) Q_DECL_NOTHROW { Swap(res); return *this; }
VBestSquare &operator=(VBestSquare &&res) Q_DECL_NOTHROW;
#endif
inline void Swap(VBestSquare &res) Q_DECL_NOTHROW
{ std::swap(d, res.d); }
void Swap(VBestSquare &res) Q_DECL_NOTHROW;
void NewResult(const VBestSquareResData &data);
void NewResult(const VBestSquare &best);