From 60e2ec9db493acfbb4d032eecd9c4bb3a830eb4c Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 20 Sep 2012 18:32:37 +0200 Subject: Workaround MSVC2008 build failure after switching to std::upper_bound QPostEventList is kept sorted by priority; std::upper_bound is used to insert a QPostEvent in the right place in the list. Turns out that MSVC2008 is a bit too picky and tries to see if the list is actually ordered. This causes a build failure as there is no operator< defined between two QPostEvents (in fact, an integer -- the priority -- is passed to std::upper_bound). Work around this issue by defining operator< between two QPostEvents. Change-Id: Ie3562dd0cc7253e25fc988b25d566d9d9e9fe62b Reviewed-by: Andreas Holzammer Reviewed-by: Marc Mutz Reviewed-by: Simon Hausmann --- src/corelib/thread/qthread_p.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 4878d59426..0667a814c3 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -86,13 +86,9 @@ public: }; Q_DECLARE_TYPEINFO(QPostEvent, Q_MOVABLE_TYPE); -inline bool operator<(int priority, const QPostEvent &pe) +inline bool operator<(const QPostEvent &first, const QPostEvent &second) { - return pe.priority < priority; -} -inline bool operator<(const QPostEvent &pe, int priority) -{ - return priority < pe.priority; + return first.priority > second.priority; } // This class holds the list of posted events. @@ -126,7 +122,7 @@ public: // insert event in descending priority order, using upper // bound for a given priority (to ensure proper ordering // of events with the same priority) - QPostEventList::iterator at = std::upper_bound(begin() + insertionOffset, end(), priority); + QPostEventList::iterator at = std::upper_bound(begin() + insertionOffset, end(), ev); insert(at, ev); } } -- cgit v1.2.3