
On Tuesday 16 August 2005 15:23, David Abrahams wrote:
Thorsten Schuett <schuett@zib.de> writes:
Hartmut and I wrote a small library which implements futures for C++. I uploaded the code to the boost-sandbox vault. If you find anything odd in there (like e.g. overloading operator T()), you have to blame me, if you find interesting stuff in there, you have to blame Hartmut.
The most basic future is simple_future<T>. Its constructor takes a function which returns T and spawns a new thread executing this function. Afterwards you can call operator()() to block until the thread is done and get the result.
<snip>
You asked for comments, so here goes: I find the apparently copious use of implicit conversions disturbing. Especially disturbing is the Hartmut already strongly opposed to include the operator T() for futures. I guess that I have to remove it :-(
The implicit conversion in the other direction is a little bit harder to get rid of. The type representing futures composed using '||' is currently to complex to easily write it down. But I need a handle to this future to pass it around. I see two solutions: - we make the type less complex, but I am not sure whether that is possible. - we add an explicit conversion function and remove the implicit conversion. Thorsten