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