summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qcollator.cpp7
-rw-r--r--src/corelib/tools/qcollator.h7
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;