mirror of
https://github.com/boostorg/coroutine2.git
synced 2025-05-09 23:24:01 +00:00
no assignment of captured_context with std::tie()
This commit is contained in:
parent
57562ffb2a
commit
79ff178d7e
@ -85,9 +85,9 @@ 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
|
||||
void * data = nullptr;
|
||||
std::tie( ctx, data) = ctx();
|
||||
set( static_cast< T * >( data) );
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
set( static_cast< T * >( std::get< 1 >( result) ) );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
@ -111,9 +111,9 @@ pull_coroutine< T >::control_block::~control_block() {
|
||||
template< typename T >
|
||||
void
|
||||
pull_coroutine< T >::control_block::resume() {
|
||||
void * data;
|
||||
std::tie( ctx, data) = ctx();
|
||||
set( static_cast< T * >( data) );
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
set( static_cast< T * >( std::get< 1 >( result) ) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -203,9 +203,9 @@ 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
|
||||
void * data = nullptr;
|
||||
std::tie( ctx, data) = ctx();
|
||||
t = static_cast< T * >( data);
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
t = static_cast< T * >( std::get< 1 >( result) );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
@ -220,9 +220,9 @@ pull_coroutine< T & >::control_block::control_block( typename push_coroutine< T
|
||||
template< typename T >
|
||||
void
|
||||
pull_coroutine< T & >::control_block::resume() {
|
||||
void * data;
|
||||
std::tie( ctx, data) = ctx();
|
||||
t = static_cast< T * >( data);
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
t = static_cast< T * >( std::get< 1 >( result) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -295,8 +295,8 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall
|
||||
#endif
|
||||
except{} {
|
||||
// enter coroutine-fn in order to have first value available after ctor (of `*this`) returns
|
||||
void * ignored = nullptr;
|
||||
std::tie( ctx, ignored) = ctx();
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
}
|
||||
|
||||
inline
|
||||
@ -310,8 +310,8 @@ pull_coroutine< void >::control_block::control_block( push_coroutine< void >::co
|
||||
inline
|
||||
void
|
||||
pull_coroutine< void >::control_block::resume() {
|
||||
void * ignored;
|
||||
std::tie( ctx, ignored) = ctx();
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ template< typename T >
|
||||
void
|
||||
push_coroutine< T >::control_block::resume( T const& data) {
|
||||
// pass an pointer to other context
|
||||
void * ignored;
|
||||
std::tie( ctx, ignored) = ctx( const_cast< T * >( & data) );
|
||||
auto result = ctx( const_cast< T * >( & data) );
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -110,8 +110,8 @@ template< typename T >
|
||||
void
|
||||
push_coroutine< T >::control_block::resume( T && data) {
|
||||
// pass an pointer to other context
|
||||
void * ignored;
|
||||
std::tie( ctx, ignored) = ctx( std::addressof( data) );
|
||||
auto result = ctx( std::addressof( data) );
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -196,8 +196,8 @@ template< typename T >
|
||||
void
|
||||
push_coroutine< T & >::control_block::resume( T & t) {
|
||||
// pass an pointer to other context
|
||||
void * ignored;
|
||||
std::tie( ctx, ignored) = ctx( const_cast< typename std::remove_const< T >::type * >( std::addressof( t) ) );
|
||||
auto result = ctx( const_cast< typename std::remove_const< T >::type * >( std::addressof( t) ) );
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
@ -275,8 +275,8 @@ push_coroutine< void >::control_block::control_block( pull_coroutine< void >::co
|
||||
inline
|
||||
void
|
||||
push_coroutine< void >::control_block::resume() {
|
||||
void * ignored;
|
||||
std::tie( ctx, ignored) = ctx();
|
||||
auto result = ctx();
|
||||
ctx = std::move( std::get< 0 >( result) );
|
||||
if ( except) {
|
||||
std::rethrow_exception( except);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user