From the QtConcurrent documentation:
QByteArray bytearray = "hello world";
QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split), ',');
...
QList<QByteArray> result = future.result();
The code snippet above appears to be binding a function in a similar way to std::tr1::bind
(std::bind
for > C++11). That is to say it's taking a non-static member function (QByteArray::split()
) and (at some point later) calling it on the specific instance of the object of which it's a member (which we've supplied as bytearray
).
How does Qt achieve this? Is it using std::tr1::bind
or boost::bind
somewhere behind the scenes?
The documentation does also refer to a case where you would use std::tr1
or boost
instead, but I don't fully understand what it means by a bound function in that context. Is the situation above in fact different/more specialised/simpler than other situations where you might otherwise use tr1
or boost
?
I've tried to make my way through the source but am getting lost very quickly!