splitFunction function = &QString::split;
QFuture<QStringList> future
= QtConcurrent
::run(string, function,
QString(","),
QString::KeepEmptyParts, Qt
::CaseSensitive);
future.waitForFinished();
qDebug() << sl.join(" -- ");
QString string = "red,blue,green";
typedef QStringList (QString::*splitFunction)(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const;
splitFunction function = &QString::split;
QFuture<QStringList> future = QtConcurrent::run(string, function, QString(","), QString::KeepEmptyParts, Qt::CaseSensitive);
future.waitForFinished();
QStringList sl = future.result();
qDebug() << sl.join(" -- ");
To copy to clipboard, switch view to plain text mode
I think it happens because QString split function is overloaded and compiler cannot determine which function is right to use in template. But I could be wrong.
Bookmarks