What is Qt for boost::promise<T>?
boost, c++, multithreading, qt
Solution
The boost::promises are means of setting values in futures. In Qt, you can't set futures, you can only return them. That's the only way of "setting" data in a future.
So, in order to set data on a future, you have to return it from a function that was invoked by `QtConcurrent::run`. To do this, you'd use any of Qt's mechanisms for communicating between threads -- events, mutex-protected variables, etc. You have to tell the thread that runs the code that would return a future that given future is to be returned. That's the only way of achieving what a promise would do.
Alas, if you want to go into the undocumented territory, then the following code does what `boost::promise::setValue` would:
QFuture<int> f;
int i = 1;
...
f.d.reportResult(&i);
// or
f.d.reportFinished(&i);
I haven't bothered checking if it works (yet).
Problem
I see that Qt has future class that is direct analog for boost::future but what is qt for boost::promise?