dimanche 2 octobre 2016

Boost coroutine2 crashes

What is wrong? I push number and I try to get it in coroutine, write it and switch context..

int main()
{
    boost::coroutines2::coroutine<int>::push_type sink(
        [&](boost::coroutines2::coroutine<int>::pull_type& source){
            std::cout << source.get() <<  std::endl;
            source();
        });

    for(int i = 0; i != 100; ++i)
    {
        sink(i);
    }

    return 0;
}

I try to run this simple code writing numbers to the output but I have an error:

/usr/local/include/boost/context/execution_context_v2.hpp:311: boost::context::execution_context<Args>::ret_tpl_t boost::context::execution_context<Args>::operator()(Args ...) [with Args = {int*}; boost::context::execution_context<Args>::ret_tpl_t = std::tuple<boost::context::execution_context<int*>, int*>]: Assertion nullptr != fctx_ failed. The program has unexpectedly finished.

Aucun commentaire:

Enregistrer un commentaire