no matching function for call to object map(*it);

2019-09-03 09:51发布

问题:

I am trying to make a call to a function multiple times but parallelize them using QtConcurrent::mapped

But I am not able to over come the error:

error: no matching function for call to object of type 'addWrapper'
        *result = map(*it);
                  ^~~

The code is as follows:

struct addWrapper {
    loadbook *instance;
    typedef QString result_type;
    addWrapper(loadbook *lBook) : instance(lBook) {}
    QString operator()(QString &item) {
        instance->decrypt->decryptFile(item,'A');
    }
};

addWrapper wrapper(this);

QFuture<QString> returnContent = QtConcurrent::mapped(fileList,wrapper);