Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.6.2
-
None
Description
We can't use functors by reference in QtConcurrent. For example like this:
QFuture<void> future = QtConcurrent::map<IteratorType, ClassType&>(begin, end, (ClassType&)*this);
Because of loosing type information, QtConcurrent use a copy of functor. Sometimes it's not useful.
We loose type information in next string (qtconcurrentmap.h line 122):
template <typename Iterator, typename MapFunctor>
QFuture<void> map(Iterator begin, Iterator end, MapFunctor map)
{
return startMap(begin, end, map);
}
Solution is to specify types directly instead of find out them from function parameters:
template <typename Iterator, typename MapFunctor>
QFuture<void> map(Iterator begin, Iterator end, MapFunctor map)
{
return startMap<Iterator, MapFunctor>(begin, end, map);
}