Why does QMap together with QtConcurrent::blockingMapped() not works?
-
I want to use QMap together with QtConcurrent::blockingMapped(). Unfortunately I get an error.
"main.cpp:490: error: no match for 'operator=' (operand types are 'QList<QList<Place>>..."
QMap<QString, QList<Place>> m_plcs; QList<Place> setAlt(QList<Place> places); ... QList<QList<Place>> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
tried also
QMap<QString, QList<Place>> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
What I'm doing wrong or is QMap not supported?
-
What's the type of 'Place'?
Also show the complete error message. -
Hi it's an 'stuct', but seems not to be the problem because it worked with
QList<Place> m_plcs; Place setAlt(QList<Place> places); ... QList<Place> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
Here the complete error message
main.cpp:490: error: no match for 'operator=' (operand types are 'QList<QList<Place> >' and 'QtPrivate::MapResultType<QMap<QString, QList<Place> >, QList<Place> (*)(QList<Place>)>::ResultType {aka void}') m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
-
So as you can see the return value of QtConcurrent::blockingMapped(m_plcs, setAlt); is QMap<QString, QList<Place>
-
@Christian-Ehrlicher Yea, but as I wrote before I tried aready
QMap<QString, QList<Place>> m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
Then I get
main.cpp:490: error: no match for 'operator=' (operand types are 'QMap<QString, QList<Place> >' and 'QtPrivate::MapResultType<QMap<QString, QList<Place> >, QList<Place> (*)(QList<Place>)>::ResultType {aka void}') m_plcsAlt = QtConcurrent::blockingMapped(m_plcs, setAlt);
I don't understand the error message. Whats going wrong here?
-
Sorry I did read something wrong.
Please see the documentation:
"The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on the items in a sequence such as a QList or a QVector."QMap is no sequence.
-
@Christian-Ehrlicher Yea, it seems so that QMap is not a sequence. Thxs!