diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-26 23:11:20 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-28 18:38:34 +0000 |
commit | 7236721bf8bacc0978fc872d7e4805c7be7824f0 (patch) | |
tree | fd8e42058c4fd6fd19a9ee3276b8460ae894001c /src/corelib | |
parent | 5f472cae71e3f1451d4b78fa9b65f7b15b9a1be1 (diff) |
QJsonObject has random-access iterators
... but they were only marked as bidirectional.
Fixed.
This change is slightly BiC, because if some class used tag
dispatching on this iterator type, a recompile might now
pick a different overload, and the old one may not be
available to a user anymore (no longer instantiated).
I do not think Qt uses that technique, yet, though. Not on
iterator categories, at least.
Change-Id: I75fb334af7e191f882d11575dec83c879a6b50ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/json/qjsonobject.cpp | 14 | ||||
-rw-r--r-- | src/corelib/json/qjsonobject.h | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index c225606717..27f937e750 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -679,8 +679,11 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const /*! \typedef QJsonObject::iterator::iterator_category - A synonym for \e {std::bidirectional_iterator_tag} indicating - this iterator is a bidirectional iterator. + A synonym for \e {std::random_access_iterator_tag} indicating + this iterator is a random-access iterator. + + \note In Qt versions before 5.6, this was set by mistake to + \e {std::bidirectional_iterator_tag}. */ /*! \typedef QJsonObject::iterator::reference @@ -886,8 +889,11 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const /*! \typedef QJsonObject::const_iterator::iterator_category - A synonym for \e {std::bidirectional_iterator_tag} indicating - this iterator is a bidirectional iterator. + A synonym for \e {std::random_access_iterator_tag} indicating + this iterator is a random-access iterator. + + \note In Qt versions before 5.6, this was set by mistake to + \e {std::bidirectional_iterator_tag}. */ /*! \typedef QJsonObject::const_iterator::reference diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h index 5b475f52ae..8535da4a6c 100644 --- a/src/corelib/json/qjsonobject.h +++ b/src/corelib/json/qjsonobject.h @@ -100,7 +100,7 @@ public: int i; public: - typedef std::bidirectional_iterator_tag iterator_category; + typedef std::random_access_iterator_tag iterator_category; typedef int difference_type; typedef QJsonValue value_type; typedef QJsonValueRef reference; @@ -143,7 +143,7 @@ public: int i; public: - typedef std::bidirectional_iterator_tag iterator_category; + typedef std::random_access_iterator_tag iterator_category; typedef int difference_type; typedef QJsonValue value_type; typedef QJsonValue reference; |