diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2010-11-02 14:20:37 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-03 10:50:48 (GMT) |
commit | d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch) | |
tree | 32306cd47731503f85a3d88881a5e28901506432 /tests/auto/qlist | |
parent | 9ff533aa0ddf944b73b0c29193fc9936c644142e (diff) | |
download | Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.zip Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.gz Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.bz2 |
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 'tests/auto/qlist')
-rw-r--r-- | tests/auto/qlist/tst_qlist.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp index 14b8057..9ab7cf7 100644 --- a/tests/auto/qlist/tst_qlist.cpp +++ b/tests/auto/qlist/tst_qlist.cpp @@ -499,6 +499,13 @@ void tst_QList::swap() const // swap again list.swap(1, 2); QCOMPARE(list, QList<QString>() << "baz" << "foo" << "bar"); + + QList<QString> list2; + list2 << "alpha" << "beta"; + + list.swap(list2); + QCOMPARE(list, QList<QString>() << "alpha" << "beta"); + QCOMPARE(list2, QList<QString>() << "baz" << "foo" << "bar"); } void tst_QList::takeAt() const |