Move-enable QPixmapCache::Key

The default constructor already sets the d-pointer to nullptr,
so the move constructor does not introduce a new state.

Change-Id: Icd47952bdf76d2106992d6babea40d68f18d067e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Marc Mutz 2015-06-15 15:08:00 +02:00
parent 9ab45763d7
commit 2de01c8388
2 changed files with 24 additions and 0 deletions

View File

@ -137,6 +137,24 @@ bool QPixmapCache::Key::operator ==(const Key &key) const
\internal
*/
/*!
\fn QPixmapCache::Key::Key(Key &&)
\internal
\since 5.6
*/
/*!
\fn QPixmapCache::Key &QPixmapCache::Key::operator=(Key &&)
\internal
\since 5.6
*/
/*!
\fn void QPixmapCache::Key::swap(Key &)
\internal
\since 5.6
*/
/*!
\internal
*/

View File

@ -48,12 +48,18 @@ public:
public:
Key();
Key(const Key &other);
#ifdef Q_COMPILER_RVALUE_REFS
Key(Key &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
Key &operator =(Key &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
~Key();
bool operator ==(const Key &key) const;
inline bool operator !=(const Key &key) const
{ return !operator==(key); }
Key &operator =(const Key &other);
void swap(Key &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
private:
KeyData *d;
friend class QPMCache;