Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.6.0, 5.7.0
-
None
-
d0b83adfe7b1d31db2e3febdd2638da0b1a13a0c (qt/qtbase/5.15)
Description
QJsonObject::iterator has iterator_category defined as std::random_access_iterator_tag, but does not implement the requirements for random-access iterators defined by the C++ standard. This causes many standard library algorithms to fail.
Specifically, given iterators a and b, the expression `a - b` must be valid, and return the distance between the two iterators. (see http://en.cppreference.com/w/cpp/concept/RandomAccessIterator)
Because the iterators promise to conform to the random access iterator concept, but don't actually implement the required interface, any code using standard library algorithms such as std::all_of fails to compile.
According to the class' documentation, the class was (correctly) tagged as a bidirectional iterator prior to 5.6. Perhaps that change should simply be reverted.