Boost logo

Boost Users :

Subject: Re: [Boost-users] Limitations of BOOST_COROUTINES_V2 (pass by reference)
From: Nat Goodspeed (nat_at_[hidden])
Date: 2014-07-04 10:27:36


On Fri, Jul 4, 2014 at 2:28 AM, Mueller-Roemer, Johannes Sebastian
<Johannes.Sebastian.Mueller-Roemer_at_[hidden]> wrote:

> Sorry for the misunderstanding, the part in the parentheses was meant to point out that I currently do not require bidirectional data flow, so I don't have a use case for that ;)

I do understand that. My question was directed more to the mailing
list in general. I'm content with unidrectional coroutine data flow
until someone surfaces a compelling use case for bidirectional.

> The auto& is not the issue and works just fine in the BOOST_COROUTINES_V1 case (and if it were, it would be a compiler bug as auto& must match std::string const &).

Could it be a compiler bug anyway? The following works fine with gcc 4.2:

#include <boost/coroutine/all.hpp>
#include <iostream>

void coro_fn(boost::coroutines::coroutine<const std::string&>::push_type& sink)
{
    sink("Hello world!\n");
}

int main(int argc, char *argv[])
{
    boost::coroutines::coroutine<const std::string&>::pull_type coro(coro_fn);
    std::cout << coro.get() << std::endl;
    return 0;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net