diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-11-13 11:27:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-15 16:44:03 +0100 |
commit | 2c450d90b6cb21fa5f4d2195d603c19c7bebb9ad (patch) | |
tree | fe4c82a863d8920cd77c1a4073569ce53a4352d8 /src/corelib | |
parent | 4225e7103825a55ecddf27c21ec6a7ab5f5d0f63 (diff) |
QCollator(SortKey): add member-swap
This is required for a Qt value type these days.
Change-Id: Ibd4e1581a4f4791a410caa10fede92c26b35dd9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qcollator.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qcollator.h | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index a3a9ef940b..cfb5fe77ae 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -118,6 +118,13 @@ QCollator &QCollator::operator=(const QCollator &other) } /*! + \fn void QCollator::swap(QCollator &other) + + Swaps this collator with \a other. This function is very fast and + never fails. +*/ + +/*! \internal */ void QCollator::detach() diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 011c2a8d02..e5abc91967 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -61,8 +61,10 @@ public: QCollatorSortKey &operator=(const QCollatorSortKey &other); #ifdef Q_COMPILER_RVALUE_REFS inline QCollatorSortKey &operator=(QCollatorSortKey &&other) - { qSwap(d, other.d); return *this; } + { swap(other); return *this; } #endif + void swap(QCollatorSortKey &other) + { d.swap(other.d); } bool operator<(const QCollatorSortKey &key) const; int compare(const QCollatorSortKey &key) const; @@ -84,6 +86,9 @@ public: ~QCollator(); QCollator &operator=(const QCollator &); + void swap(QCollator &other) + { qSwap(d, other.d); } + void setLocale(const QLocale &locale); QLocale locale() const; |