[coroutine] help with code from docs
I'm trying to understand coroutine usage with boost 1.53.0. I'm getting
an assertion when running the code snippet from the docs "Creating a
coroutine" from
http://www.boost.org/doc/libs/1_53_0/libs/coroutine/doc/html/coroutine/corou...
#include
two solutions void f( coro_t::caller_type & ca)
{
std::string str( ca.get() ); // asserts here!
ca(7); }
int main(int argc, char* argv[]) { std::string str("abc");
coro_t c(f);
c(str); // pass argument
int res = c.get(); // returned value
return 0; }
Asserts in coroutine_get.hpp line 43:
BOOST_ASSERT( static_cast< D const* >( this)->impl_->result_);
Is the snippet from the doc incorrect or am I doing something else wrong.
Thanks, Jeff
______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**usershttp://lists.boost.org/mailman/listinfo.cgi/boost-users
On 9/12/2013 11:56 AM, Oliver Kowalke wrote:
void f( coro_t::caller_type & ca) { std::string str( ca.get() ); // asserts here!
ca(7); }
int main(int argc, char* argv[]) { std::string str("abc");
coro_t c(f);
coro_t c( f, str); // pass str to ctor -> because accessed in f() int res = c.get(); // returned value
I see this approach described further down the page that I cited. Which is inconsistent with the initial code sample on that page. So are you saying the first code snippet in the docs is incorrect? Thanks, jeff
participants (2)
-
Jeff Flinn
-
Oliver Kowalke