no assignment of captured_context with std::tie()

This commit is contained in:
Oliver Kowalke 2016-01-03 17:43:13 +01:00
parent 57562ffb2a
commit 79ff178d7e
2 changed files with 27 additions and 27 deletions

View File

@ -37,7 +37,7 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc,
other{ nullptr },
#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS)
ctx{ std::allocator_arg, palloc, salloc,
std::move(
std::move(
std::bind(
[this]( typename std::decay< Fn >::type & fn_, boost::context::captured_context ctx, void *) mutable {
// create synthesized push_coroutine< T >
@ -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);
}
@ -156,7 +156,7 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo
other{ nullptr },
#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS)
ctx{ std::allocator_arg, palloc, salloc,
std::move(
std::move(
std::bind(
[this]( typename std::decay< Fn >::type & fn_, boost::context::captured_context ctx, void *) mutable {
// create synthesized push_coroutine< T >
@ -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);
}
@ -249,7 +249,7 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall
other{ nullptr },
#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS)
ctx{ std::allocator_arg, palloc, salloc,
std::move(
std::move(
std::bind(
[this]( typename std::decay< Fn >::type & fn_, boost::context::captured_context ctx, void *) mutable {
// create synthesized push_coroutine< T >
@ -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);
}

View File

@ -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);
}