Details
-
User Story
-
Resolution: Done
-
P2: Important
-
5.1.1
-
-
13
-
Qt6_Foundation_ Sprint 4, Qt6_Foundation_ Sprint 5, Qt6_Foundation_ Sprint 6
Description
QtConcurrent::mapped currently supports function pointers, pointer to member-functions, and functors which define a nested typedef result_type as map and reduce functions. Lambda expressions don't have that typedef, so compilation fails.
Workaround: stateless lambdas decay into function pointers, so you use the dereference operator to make them into function references, which again decay to function pointers, to force a function pointer deduction:
<code>
auto result = QtConcurrent::blockingMapped(someList, *[=](ListItem item)
);
</code>
QtConcurrent should not require result_type nested typedefs.
Attachments
Issue Links
- is duplicated by
-
QTBUG-61145 QtConcurrent::blockingMappedReduced cannot deduce mapped type
-
- Closed
-
- relates to
-
QTBUG-67603 Doc: Example code snippet for QtConcurrent::mapped does not compile
-
- Closed
-
For Gerrit Dashboard: QTBUG-33735 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
292429,1 | Fix QtConcurrent::{mapped|blockingMapped) to work with lambdas | dev | qt/qtbase | Status: ABANDONED | +2 | 0 |
295298,9 | Improve Map|Map-Reduce and Filter|Filter-Reduce implementation | dev | qt/qtbase | Status: MERGED | +2 | 0 |