diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-08-15 12:39:41 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-05 13:29:43 +0200 |
commit | e3e42322c077b15970e15362420199a7be5ccf3d (patch) | |
tree | d329c0460b366795b64b4e6f5099bb0e102f861f /src/corelib/itemmodels | |
parent | f4714459a864bbdeb476f94228600ea7b24aadb2 (diff) |
Add some easy move constructors
These are easy, since they can be inline. Most types that would
benefit from move constructors can't have inline move constructors
because these types use smart pointers whose destructor is invoked
in the type's move constructor. Implementing move constructors
out-of-line would break binary compatibility between C++98 and C++11
builds of Qt and its users, so that is not attempted here.
Change-Id: I7f14437c2069cce54c498c7858f4e9060ff05e7b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 6a57ccaca8..a0ac33e8a8 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -110,6 +110,11 @@ public: inline bool operator!=(const QPersistentModelIndex &other) const { return !operator==(other); } QPersistentModelIndex &operator=(const QPersistentModelIndex &other); +#ifdef Q_COMPILER_RVALUE_REFS + inline QPersistentModelIndex(QPersistentModelIndex &&other) : d(other.d) { other.d = 0; } + inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) + { qSwap(d, other.d); return *this; } +#endif inline void swap(QPersistentModelIndex &other) { qSwap(d, other.d); } bool operator==(const QModelIndex &other) const; bool operator!=(const QModelIndex &other) const; |