On Wed, Jan 22, 2014 at 7:30 AM, Vicente J. Botet Escriba
Le 22/01/14 03:39, Nat Goodspeed a écrit :
In my (obviously incomplete) mental model, a hypothetical fiber constructor:
fiber f(some_callable, 3.14, "a string", 17);
would be completely equivalent to:
fiber f(bind(some_callable, 3.14, "a string", 17));
What am I missing? (If this is already well-explained elsewhere, I would appreciate a pointer as much as your own explanation.)
boost::bind is not movable :( or is it in C++11?)
I haven't yet read Agustín's links -- but I will, thank you! Since movable-only callables are clearly an important use case, I would hope that if (let's say) std::bind is not yet itself movable, that's a transient situation which will soon be remedied.
if you asked me to implement a variadic fiber constructor (and async() function), I would immediately forward to bind() inside each. Would that be a sufficient implementation? If not, why not?
Again, the material to which Agustín points me may answer this question. But if using bind() is not an option even internally -- must Oliver (along with the author of every library that supports user callables!) reimplement bind() by hand, with support for movable types?
A broader question to those who requested a variadic fiber constructor (and async()): is it sufficient to provide that support only when the compiler supports variadic templates, or are you asking for the whole ugly C++03 workaround as well?
From my side this variadic versions must be provided for C++11 compilers at least. Any attempt to make the C++98 interface close to the C++11 would be welcome.
Agustín, too, says "C++03 support would be nice." Having myself implemented the preprocessor iteration for a C++03 API accepting callable-with-up-to-N-args, I know it's a bit of a pain. Moreover (a key point) anyone invoking the Fiber API who is constrained to C++03 features will not have movable-only types. In that scenario, fiber(bind(callable, arg1, arg2)) *is* completely equivalent to fiber(callable, arg1, arg2). So when discussing the requested variadic fiber constructor, I will tease apart the C++11 and C++03 cases. I feel pretty comfortable stating that the former is much more important than the latter.