Boost logo

Boost :

Subject: Re: [boost] Boost.Fiber review January 6-15
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-01-22 13:54:07

Le 22/01/14 17:07, Nat Goodspeed a écrit :
> On Wed, Jan 22, 2014 at 7:30 AM, Vicente J. Botet Escriba
> <vicente.botet_at_[hidden]> wrote:
>> 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.
I think that std::bind is movable.
>>> 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."
Me too. It would be nice, but not mandatory. In C++03, it is impossible
to implement perfect forwarding.
> 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).
I disagree. We have Boost/Move.
> 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.
Agreed, but at least the C++03 must support movables types.


Boost list run by bdawes at, gregod at, cpdaniel at, john at