From c40a48af997f57caa0ecfca0b247837ba5b2f89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Alvarez?= Date: Sat, 14 Sep 2013 01:00:48 -0300 Subject: [PATCH] QtDBus: fix build on MSVC2008 Debug mode. Normally, searching for a V in a container of T using std::lower_bound only needs an operator<(T,V). But in MSVC2008 debug mode, STL algorithms perform some extra checks, such as ensuring the range passed to std::lower_bound is sorted. This adds a requirement for operator<(T,T) and operator<(V,T). QtDBus didn't compile on MSVC2008+Debug since 1e37d854 (Sept 2012!) because it missed those operator overloads for some private types. Task-number: QTBUG-33473 Change-Id: I18902d86e6c58349eb7ba3601dc383ad5431c460 Reviewed-by: Thiago Macieira --- src/dbus/qdbusabstractadaptor_p.h | 4 ++++ src/dbus/qdbusconnection_p.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/dbus/qdbusabstractadaptor_p.h b/src/dbus/qdbusabstractadaptor_p.h index 3dc8cd320e5..284b0fb7061 100644 --- a/src/dbus/qdbusabstractadaptor_p.h +++ b/src/dbus/qdbusabstractadaptor_p.h @@ -104,6 +104,10 @@ public: // typedefs { return QLatin1String(interface) < other; } inline bool operator<(const QByteArray &other) const { return interface < other; } +#if defined(Q_CC_MSVC) && _MSC_VER < 1600 + friend inline bool operator<(const QString &str, const AdaptorData &obj) + { return str < QLatin1String(obj.interface); } +#endif }; typedef QVector AdaptorMap; diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index a61fdaf6c33..7053bb5e01b 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -148,6 +148,14 @@ public: { return name < other; } inline bool operator<(const QStringRef &other) const { return QStringRef(&name) < other; } +#if defined(Q_CC_MSVC) && _MSC_VER < 1600 + inline bool operator<(const ObjectTreeNode &other) const + { return name < other.name; } + friend inline bool operator<(const QString &str, const ObjectTreeNode &obj) + { return str < obj.name; } + friend inline bool operator<(const QStringRef &str, const ObjectTreeNode &obj) + { return str < QStringRef(&obj.name); } +#endif inline bool isActive() const { return obj || !children.isEmpty(); }