diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-19 21:12:21 +0200 |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-03 12:57:10 +0200 |
commit | da0e1a682362144b9f13b4c564f86e09efb681bb (patch) | |
tree | 8cbf68a93b055515b2a56d9e0667c530b27e39e2 /src/corelib/tools/qlist.h | |
parent | 605aa0cf1889110620dc0d5d84066be8177fe9c2 (diff) |
C++0x move operators
This makes assignement faster from temporaries, as the operator is
fully inline, and doesn't do any atomic operations.
Reviewed-by: joao
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 1282bcae3c..b1d07bdb3c 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -118,6 +118,10 @@ public: inline QList(const QList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } ~QList(); QList<T> &operator=(const QList<T> &l); +#ifdef Q_COMPILER_RVALUE_REFS + inline QList &operator=(QList &&other) + { qSwap(d, other.d); return *this; } +#endif bool operator==(const QList<T> &l) const; inline bool operator!=(const QList<T> &l) const { return !(*this == l); } |