Boost logo

Boost :

Subject: Re: [boost] [coroutine] new versions
From: Eugene Yakubovich (eyakubovich_at_[hidden])
Date: 2012-10-05 19:15:32


On Fri, Oct 5, 2012 at 5:20 PM, Vicente J. Botet Escriba
<vicente.botet_at_[hidden]> wrote:
> Le 05/10/12 21:46, Oliver Kowalke a écrit :
>
>> Am 05.10.2012 21:27, schrieb Vicente J. Botet Escriba:
>>>
>>> Anyway, maybe the use of the get accessor can be made more readable
>>> without effort using tags
>>>
>>> struct a{};
>>> struct b{};
>>> typedef coroutine< int( tagged<int, a>, tagged<int,b> > > coro_t;
>>> int fn( coro_t::self_t & c) {
>>> int x = c.get< a >();
>>> int y = c.get< b >();
>>> c.yield( x +y);
>>> ...
>>> }
>>>
>> does boost.tuple provide such a facility?
>
>
> If Boost.Tuple doesn't provides them, Boost.Fusion tuple provides them
> already.

Maybe if c.get() returns a tuple, boost::tie can be used to improve readability:

int x, y;
boost::tie(x, y) = c.get();

This doesn't cover the cases when the types are not default
constructable but that's a minority of times.
I'm going to need this weekend to study the new designs before
providing more feedback.

-Eugene


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk