Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.2, 5.4.0 Alpha
-
None
-
Ubuntu 14.04 x64
Gcc 4.8.2
Qt 5.3.2
-
eb05bda4f2fc1b9abe0c91d0b9e52c9633f5fff5
Description
The QJsonArray::iterator and QJsonArray::const_iterator classes are missing the pointer typedef. This is causing errors when trying to use std::sort with a custom comparator.
Example:
QJsonArray devices; // ... std::sort(devices.begin(), devices.end(), [](const QJsonValueRef &lhs, const QJsonValueRef &rhs){ return lhs.toString() < rhs.toString(); });
Error Message:
/home/kgardner/Qt/Boot2Qt-2.x/iMX6-eLinux/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/bits/stl_iterator_base_types.h: In instantiation of 'struct std::__iterator_traits<QJsonArray::iterator, true>': /home/kgardner/Qt/Boot2Qt-2.x/iMX6-eLinux/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/bits/stl_iterator_base_types.h:159:12: required from 'struct std::iterator_traits<QJsonArray::iterator>' /home/kgardner/Qt/Boot2Qt-2.x/iMX6-eLinux/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/bits/stl_algo.h:5501:2: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = QJsonArray::iterator; _Compare = ProgramWatcher::initializeCache()::__lambda150]' /home/kgardner/working_copy/ExpertPowerControls/src/SystemManager/src/Watchers/programwatcher.cpp:301:14: required from here /home/kgardner/Qt/Boot2Qt-2.x/iMX6-eLinux/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/bits/stl_iterator_base_types.h:154:53: error: no type named 'pointer' in 'class QJsonArray::iterator' typedef typename _Iterator::pointer pointer; ^
Attachments
For Gerrit Dashboard: QTBUG-41628 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
99716,2 | QJsonArray::(const_)iterator: add the typedef for the pointer type | 5.4.0 | qt/qtbase | Status: MERGED | -1 | 0 |