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 <thiago.macieira@intel.com>
This commit is contained in:
Nicolás Alvarez 2013-09-14 01:00:48 -03:00 committed by The Qt Project
parent c8411a0281
commit c40a48af99
2 changed files with 12 additions and 0 deletions

View File

@ -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<AdaptorData> AdaptorMap;

View File

@ -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(); }