From c7210733db74be38a8ae5ebca1ae01a50f821e41 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Fri, 1 Jul 2016 17:58:13 +0200 Subject: [PATCH] call resume() in ctor of pull_coroutine --- .../coroutine2/detail/pull_control_block_ecv2.ipp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp b/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp index b5e0397..766a3f5 100644 --- a/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp +++ b/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp @@ -109,9 +109,7 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc, bvalid{ false }, storage{} { // enter coroutine-fn in order to have first value available after ctor (of `*this`) returns - auto result = ctx( nullptr); - ctx = std::move( std::get< 0 >( result) ); - set( std::get< 1 >( result) ); + resume(); } template< typename T > @@ -260,9 +258,7 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo except{}, t{ nullptr } { // enter coroutine-fn in order to have first value available after ctor (of `*this`) returns - auto result = ctx( nullptr); - ctx = std::move( std::get< 0 >( result) ); - t = std::get< 1 >( result); + resume(); } template< typename T > @@ -382,7 +378,7 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall state{ state_t::unwind }, except{} { // enter coroutine-fn in order to have first value available after ctor (of `*this`) returns - ctx = ctx(); + resume(); } inline