diff options
author | Ville Voutilainen <ville.voutilainen@qt.io> | 2017-12-05 16:31:53 +0200 |
---|---|---|
committer | Ville Voutilainen <ville.voutilainen@qt.io> | 2017-12-08 04:43:38 +0000 |
commit | 9856f869f5cd4b7651c10b71b824aff4c006cf3b (patch) | |
tree | a93ca898f46ae27f452aa1f195d73f50341c1b6a /src/concurrent/qtconcurrentmap.cpp | |
parent | 216b68083053584497ddf29569ef386c1fa04045 (diff) |
Fix documentation for function objects with map/reduce
The documentation claims that function objects just work with
map-reduce. They work for the map function, but not for the reduce
function. Making them work for the reduce function was deemed
too complex for questionable benefit, so this patch explains
the situation and provides a work-around.
Task-number: QTBUG-22710
Change-Id: I7f706468e36031bc261234310d331001b96e5137
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentmap.cpp')
-rw-r--r-- | src/concurrent/qtconcurrentmap.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index 884bf4b4f9..1ba5de355b 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -192,12 +192,19 @@ \section2 Using Function Objects QtConcurrent::map(), QtConcurrent::mapped(), and - QtConcurrent::mappedReduced() accept function objects, which can be used to + QtConcurrent::mappedReduced() accept function objects + for the map function. These function objects can be used to add state to a function call. The result_type typedef must define the result type of the function call operator: \snippet code/src_concurrent_qtconcurrentmap.cpp 14 + For the reduce function, function objects are not directly + supported. Function objects can, however, be used + when the type of the reduction result is explicitly specified: + + \snippet code/src_concurrent_qtconcurrentmap.cpp 11 + \section2 Wrapping Functions that Take Multiple Arguments If you want to use a map function that takes more than one argument you can |