From c4fd65e40d093908f4f5be919a88930c799a2569 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 3 Sep 2015 13:19:09 +0200 Subject: OrderBy: Replace deprecated qLess by std::less. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning: expr\qorderby.cpp:79:7: warning: 'template class qLess' is deprecated [-Wdeprecated-declarations] class qLess ^ In file included from qtbase\include\QtCore/qalgorithms.h:1:0, from qtbase\include\QtCore/QtAlgorithms:1, from expr\qorderby.cpp:34: qtbase/src/corelib/tools/qalgorithms.h:150:40: note: declared here class QT_DEPRECATED_X("Use std::less") qLess ^ expr\qorderby.cpp: In member function 'virtual QAbstractXmlForwardIterator::Ptr QPatternist::OrderBy::evaluateSequence(const Ptr&) const': expr\qorderby.cpp:172:11: warning: 'template class qLess' is deprecated [-Wdeprecated-declarations] const qLess sorter(m_orderSpecs, context); ^ In file included from qtbase\include\QtCore/qalgorithms.h:1:0, from qtbase\include\QtCore/QtAlgorithms:1, from expr\qorderby.cpp:34: Change-Id: Ieb626eb0de96aea670433bb46a52ed780240e8d7 Reviewed-by: Björn Breitmeyer --- src/xmlpatterns/expr/qorderby.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/xmlpatterns/expr/qorderby.cpp b/src/xmlpatterns/expr/qorderby.cpp index ba6bcb2..7dbf320 100644 --- a/src/xmlpatterns/expr/qorderby.cpp +++ b/src/xmlpatterns/expr/qorderby.cpp @@ -44,6 +44,7 @@ #include "qorderby_p.h" #include +#include QT_BEGIN_NAMESPACE @@ -72,11 +73,17 @@ void OrderBy::OrderSpec::prepare(const Expression::Ptr &source, * @short Functor used by Qt's qSort() and qStableSort(). Used for FLWOR's * order by expression. * - * This must be in the global namespace, since it is specializing qLess(), which - * is in the global namespace. Hence it can't be in QPatternist. + * This must be in the std namespace, since it is specializing std::less(), which + * is in the std namespace. Hence it can't be in QPatternist. */ + +QT_END_NAMESPACE + +QT_USE_NAMESPACE + +namespace std { template<> -class qLess +struct less { private: @@ -87,9 +94,9 @@ private: } public: - inline qLess(const OrderBy::OrderSpec::Vector &orderspecs, - const DynamicContext::Ptr &context) : m_orderSpecs(orderspecs) - , m_context(context) + inline less(const OrderBy::OrderSpec::Vector &orderspecs, + const DynamicContext::Ptr &context) : m_orderSpecs(orderspecs) + , m_context(context) { Q_ASSERT(!m_orderSpecs.isEmpty()); Q_ASSERT(context); @@ -158,6 +165,9 @@ private: const OrderBy::OrderSpec::Vector & m_orderSpecs; const DynamicContext::Ptr & m_context; }; +} // namespace std + +QT_BEGIN_NAMESPACE Item::Iterator::Ptr OrderBy::mapToSequence(const Item &i, const DynamicContext::Ptr &) const @@ -169,7 +179,7 @@ Item::Iterator::Ptr OrderBy::evaluateSequence(const DynamicContext::Ptr &context { Item::List tuples(m_operand->evaluateSequence(context)->toList()); - const qLess sorter(m_orderSpecs, context); + const std::less sorter(m_orderSpecs, context); Q_ASSERT(m_stability == StableOrder || m_stability == UnstableOrder); -- cgit v1.2.1