diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-07-03 13:24:31 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-10-07 19:05:33 +0000 |
commit | f89803e459ca02ad4be0c2e1620b80b0cb248642 (patch) | |
tree | b77f9fca301d00426d6a61ca9966daa2963d6901 /src/corelib/tools/qlist.h | |
parent | 52812e9a2b578d3c25f85612a6fdcffbdefd84e1 (diff) |
Make container move semantics consistent
Make all containers (excepting QVarLengthArray)
- nothrow default-constructible
- nothrow move-constructible
- nothrow move-assignable
- nothrow swappable
[ChangeLog][QtCore] All containers (with the exception of QVarLengthArray,
but including QSharedPointer) are now nothrow_default_constructible,
nothrow_move_constructible, nothrow_move_assignable, and nothrow-swappable.
Change-Id: I12138d262f9f7f600f0e1218137da208c12e7c0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 32e0141d55..9a57a2c6a5 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -143,11 +143,12 @@ public: ~QList(); QList<T> &operator=(const QList<T> &l); #ifdef Q_COMPILER_RVALUE_REFS - inline QList(QList<T> &&other) : d(other.d) { other.d = const_cast<QListData::Data *>(&QListData::shared_null); } - inline QList &operator=(QList<T> &&other) + inline QList(QList<T> &&other) Q_DECL_NOTHROW + : d(other.d) { other.d = const_cast<QListData::Data *>(&QListData::shared_null); } + inline QList &operator=(QList<T> &&other) Q_DECL_NOTHROW { QList moved(std::move(other)); swap(moved); return *this; } #endif - inline void swap(QList<T> &other) { qSwap(d, other.d); } + inline void swap(QList<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QList(std::initializer_list<T> args) : d(const_cast<QListData::Data *>(&QListData::shared_null)) |