From e721cf15081c8174a38797cc88f7c5197d9e527c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:25:19 +0100 Subject: QCollatorSortKey: inline operator< This code was duplicated in every qcollator_platform.cpp and identical everywhere, except in _icu, which uses a QByteArray m_key and the implementation used QByteArray::operator<, which is semantically and probably code-wise identical to what the other implementations did (after inlining). Inlining this function removes a potential maintenance problem and increases speed without violating encapsulation. Change-Id: If3e9d38a7d4326b49f0611a9f4187c53960e8a03 Reviewed-by: Lars Knoll --- src/corelib/tools/qcollator.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools/qcollator.h') diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 941637e200..781e95b10c 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -66,7 +66,6 @@ public: void swap(QCollatorSortKey &other) { d.swap(other.d); } - bool operator<(const QCollatorSortKey &key) const; int compare(const QCollatorSortKey &key) const; protected: @@ -78,6 +77,11 @@ private: QCollatorSortKey(); }; +inline bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) +{ + return lhs.compare(rhs) < 0; +} + class Q_CORE_EXPORT QCollator { public: -- cgit v1.2.3