summaryrefslogtreecommitdiffstats
path: root/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-07-22 18:49:45 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2021-08-18 22:31:17 +0200
commit8aefbe67bf445d51f41c16ec00bc5ce3ec18ded5 (patch)
tree5485d33e6d07b3d19b8dfd794b799fb223321bfb /src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
parent96810e3863272eb5463ba5c07d82544810bdb3f8 (diff)
QtConcurrent: fix examples of overloaded methods in docs
Wrap the overloaded methods in qOverload(), to make the examples compile. Also remove the extra whitespaces when declaring nested templates. Pick-to: 6.1 6.2 Change-Id: If438caa6d705d9036dae45278fb26e080918da89 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp')
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
index 9c91715ac0..c57f3bf6db 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
@@ -135,7 +135,8 @@ QFuture<QImage> bgrImages = QtConcurrent::mapped(images,
// Create a set of the lengths of all strings in a list.
QStringList strings = ...;
-QFuture<QSet<int> > wordLengths = QtConcurrent::mappedReduced(strings, &QString::length, &QSet<int>::insert);
+QFuture<QSet<int>> wordLengths = QtConcurrent::mappedReduced(strings, &QString::length,
+ qOverload<const int&>(&QSet<int>::insert));
//! [8]
@@ -150,7 +151,8 @@ QFuture<int> averageWordLength = QtConcurrent::mappedReduced(strings, &QString::
// Create a set of the color distribution of all images in a list.
extern int colorDistribution(const QImage &string);
QList<QImage> images = ...;
-QFuture<QSet<int> > totalColorDistribution = QtConcurrent::mappedReduced(images, colorDistribution, QSet<int>::insert);
+QFuture<QSet<int>> totalColorDistribution = QtConcurrent::mappedReduced(images, colorDistribution,
+ qOverload<const int&>(&QSet<int>::insert));
//! [9]