QtConcurrent::BlockingMap using member functions (with an argument) without C++11 or boost
-
Hello,
How to do the exact same thing without C++11 (or boost) ?
QtConcurrent::BlockingMap(fileinfolist, [=](QFileInfo fi){ myMemberFunction(fi); }@kamui said in QtConcurrent::BlockingMap using member functions (with an argument) without C++11 or boost:
How to do the exact same thing without C++11 (or boost) ?
If don't want to use lambda function, declare a local function and call it with
QtConcurrent::BlockingMap==> https://doc.qt.io/qt-5/qtconcurrentmap.html#concurrent-map -
Hi,
Note that if you use a version of Qt that is 5.7 or more recent, C++11 is mandatory to have so you can go on with lambdas.
-
Sadly it's for a version of the app still running on 5.5 ...
And I can't manage to make it work with something like this :
QtConcurrent::BlockingMap(fileinfolist, &MyClass::MyMemberFunction);because myMemberFunction expects an arguement (other than this)
-
Sadly it's for a version of the app still running on 5.5 ...
And I can't manage to make it work with something like this :
QtConcurrent::BlockingMap(fileinfolist, &MyClass::MyMemberFunction);because myMemberFunction expects an arguement (other than this)
-
Yes I tried it, because of the compiler message error :
QtConcurrent::BlockingMap(fileinfolist, &MyClass::MyMemberFunction);

QtConcurrent::BlockingMap(fileinfolist, this, &MyClass::MyMemberFunction);

As you can see, I can't have the good amount of arguments xD
-
Yes I tried it, because of the compiler message error :
QtConcurrent::BlockingMap(fileinfolist, &MyClass::MyMemberFunction);

QtConcurrent::BlockingMap(fileinfolist, this, &MyClass::MyMemberFunction);

As you can see, I can't have the good amount of arguments xD
@kamui I apologize, I wrote something stupid, this cannot work!
You have to define a function to be called with each of the element from the sequence:
void myMapFunction(const QFileInfo &fi) { /// do stuff } ... QtConcurrent::blockingMap(fileinfolist, myMapFunction);