summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtconcurrentmap.cpp
diff options
context:
space:
mode:
authorSze Howe Koh <szehowe.koh@gmail.com>2017-03-02 22:41:29 +0800
committerSze Howe Koh <szehowe.koh@gmail.com>2017-03-07 04:35:23 +0000
commit58cc126defe4528ba171c812fd7544027190175e (patch)
treec17fa77da0c15315dd6d775c5d827fb13b4f7cba /src/concurrent/qtconcurrentmap.cpp
parent9390c44338b74373c6c076ac2df836ba471c43b0 (diff)
Doc: Replace std::bind() with lambdas in Qt Concurrent
Lambda functions provide all the benefits of std::bind() plus more Change-Id: Iec30b20bb35ac0fae560435b323f80af2f2e5fce Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/concurrent/qtconcurrentmap.cpp')
-rw-r--r--src/concurrent/qtconcurrentmap.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp
index e6c347b511..884bf4b4f9 100644
--- a/src/concurrent/qtconcurrentmap.cpp
+++ b/src/concurrent/qtconcurrentmap.cpp
@@ -198,13 +198,11 @@
\snippet code/src_concurrent_qtconcurrentmap.cpp 14
- \section2 Using Bound Function Arguments
+ \section2 Wrapping Functions that Take Multiple Arguments
If you want to use a map function that takes more than one argument you can
- use std::bind() to transform it onto a function that takes one argument. If
- C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
- {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {std::tr1::bind()} are suitable replacements.
+ use a lambda function or \c std::bind() to transform it onto a function that
+ takes one argument.
As an example, we'll use QImage::scaledToWidth():
@@ -216,16 +214,6 @@
QImage::scaledToWidth() with QtConcurrent::mapped() we have to provide a
value for the \e{width} and the \e{transformation mode}:
- \snippet code/src_concurrent_qtconcurrentmap.cpp 11
-
- The return value from std::bind() is a function object (functor) with
- the following signature:
-
- \snippet code/src_concurrent_qtconcurrentmap.cpp 12
-
- This matches what QtConcurrent::mapped() expects, and the complete example
- becomes:
-
\snippet code/src_concurrent_qtconcurrentmap.cpp 13
*/