How can I use QtConcurrent::mapped
with a member function as operator? Currently I'm using a callable object (which is ugly solution):
struct Vectorizer {
Vectorizer(DialogCreateSamples* cs)
: m_createSamples(cs) { }
typedef QString result_type;
QString operator()(const QString &input)
{
return m_createSamples->generateVector(input);
}
DialogCreateSamples* m_createSamples;
};
QFuture<QString> future = QtConcurrent::mapped(m_inputs,Vectorizer(this));
Also tried to pass lambda expressions but compiler says there is no result_type
defined in lambda. This works with QtConcurrent::map
because map
do not need result_type
. So if I can add a typedef
in lambda it should work...