QHashIterator with QMultiHash
-
Hi,
in Qt 6.5, MSVC2019, 64bit (Qt 5.15 works by the way)QMultiHash<QString, QString> multiHash; QHashIterator<QString, QString> it(multiHash); // compile error: C2664
No matching constructor for initialization of 'QHashIterator<QString, QString>'
note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'QMultiHash<QString, QString>' to 'const QHashIterator<QString, QString>' for 1st argument
note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'QMultiHash<QString, QString>' to 'QHashIterator<QString, QString>' for 1st argument
note: candidate constructor not viable: no known conversion from 'QMultiHash<QString, QString>' to 'const QHash<QString, QString>' for 1st argument -
Looks like a documentation error which was not adjusted from Qt5 to Qt6 as QMultiHash no longer derives from QHash. You have to use QMultiHashIterator now or use c++ style iterators / range-based for loop.
I wonder why these iterators were not removed in Qt6 though... -