diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2010-11-02 15:20:37 +0100 |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-03 11:50:48 +0100 |
commit | d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch) | |
tree | 32306cd47731503f85a3d88881a5e28901506432 /src/corelib/tools/qlist.h | |
parent | 9ff533aa0ddf944b73b0c29193fc9936c644142e (diff) |
Containers: add member-swap
Member-swap is required by the STL Sequence concept, but is also needed to write exception-safe code.
Merge-request: 871
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 8f988d60a2..b1fcabfa8c 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -126,6 +126,7 @@ public: inline QList &operator=(QList &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QList<T> &other) { qSwap(d, other.d); } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QList(std::initializer_list<T> args) : d(&QListData::shared_null) { d->ref.ref(); qCopy(args.begin(), args.end(), std::back_inserter(*this)); } |