diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index c00220ad3a..49ccbc9c9f 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -413,7 +413,8 @@ private: bool isValidIterator(const iterator &i) const Q_DECL_NOTHROW { - return (constBegin().i <= i.i) && (i.i <= constEnd().i); + const std::less less = {}; + return !less(i.i, cbegin().i) && !less(cend().i, i.i); } private: diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index b74b1fd123..597e7464cb 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -254,7 +254,8 @@ private: bool isValidIterator(const const_iterator &i) const { - return (i <= constEnd()) && (constBegin() <= i); + const std::less less = {}; + return !less(cend(), i) && !less(i, cbegin()); } }; diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 345ba4b097..30fd7b2865 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -306,7 +306,8 @@ private: void destruct(T *from, T *to); bool isValidIterator(const iterator &i) const { - return (i <= d->end()) && (d->begin() <= i); + const std::less less = {}; + return !less(d->end(), i) && !less(i, d->begin()); } class AlignmentDummy { Data header; T array[1]; }; };