mirror of
https://github.com/boostorg/coroutine2.git
synced 2025-05-09 23:24:01 +00:00
use C++14 feature lambda capture expressions
This commit is contained in:
parent
c37afa91ca
commit
a390cc2fbd
@ -31,6 +31,6 @@ which includes all the other headers in turn.
|
|||||||
|
|
||||||
All functions and classes are contained in the namespace __coro_ns__.
|
All functions and classes are contained in the namespace __coro_ns__.
|
||||||
|
|
||||||
[note __boost_coroutine__ is C++11-only!]
|
[note __boost_coroutine__ is C++14-only!]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/context/execution_context.hpp>
|
#include <boost/context/execution_context.hpp>
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/rref.hpp>
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
#endif
|
#endif
|
||||||
@ -32,7 +30,7 @@ struct pull_coroutine< T >::control_block {
|
|||||||
std::exception_ptr except;
|
std::exception_ptr except;
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
control_block( context::preallocated, StackAllocator, rref< Fn >, bool);
|
control_block( context::preallocated, StackAllocator, Fn &&, bool);
|
||||||
|
|
||||||
explicit control_block( typename push_coroutine< T >::control_block *);
|
explicit control_block( typename push_coroutine< T >::control_block *);
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ struct pull_coroutine< T & >::control_block {
|
|||||||
std::exception_ptr except;
|
std::exception_ptr except;
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
control_block( context::preallocated, StackAllocator, rref< Fn >, bool);
|
control_block( context::preallocated, StackAllocator, Fn &&, bool);
|
||||||
|
|
||||||
explicit control_block( typename push_coroutine< T & >::control_block *);
|
explicit control_block( typename push_coroutine< T & >::control_block *);
|
||||||
|
|
||||||
@ -79,7 +77,7 @@ struct pull_coroutine< void >::control_block {
|
|||||||
std::exception_ptr except;
|
std::exception_ptr except;
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
control_block( context::preallocated, StackAllocator, rref< Fn >, bool);
|
control_block( context::preallocated, StackAllocator, Fn &&, bool);
|
||||||
|
|
||||||
explicit control_block( push_coroutine< void >::control_block *);
|
explicit control_block( push_coroutine< void >::control_block *);
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
#include <boost/coroutine2/detail/forced_unwind.hpp>
|
#include <boost/coroutine2/detail/forced_unwind.hpp>
|
||||||
#include <boost/coroutine2/detail/rref.hpp>
|
|
||||||
#include <boost/coroutine2/detail/state.hpp>
|
#include <boost/coroutine2/detail/state.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
@ -32,18 +31,18 @@ namespace detail {
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
pull_coroutine< T >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
pull_coroutine< T >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
||||||
rref< Fn > rr, bool preserve_fpu_) :
|
Fn && fn_, bool preserve_fpu_) :
|
||||||
other( nullptr),
|
other( nullptr),
|
||||||
caller( boost::context::execution_context::current() ),
|
caller( boost::context::execution_context::current() ),
|
||||||
callee( palloc, salloc,
|
callee( palloc, salloc,
|
||||||
[=] () mutable {
|
[=,fn=std::forward< Fn >( fn_)] () mutable {
|
||||||
try {
|
try {
|
||||||
// create synthesized push_coroutine< T >
|
// create synthesized push_coroutine< T >
|
||||||
typename push_coroutine< T >::control_block synthesized_cb( this);
|
typename push_coroutine< T >::control_block synthesized_cb( this);
|
||||||
push_coroutine< T > synthesized( & synthesized_cb);
|
push_coroutine< T > synthesized( & synthesized_cb);
|
||||||
other = & synthesized_cb;
|
other = & synthesized_cb;
|
||||||
// call coroutine-fn with synthesized push_coroutine as argument
|
// call coroutine-fn with synthesized push_coroutine as argument
|
||||||
rr( synthesized);
|
fn( synthesized);
|
||||||
} catch ( forced_unwind const&) {
|
} catch ( forced_unwind const&) {
|
||||||
// do nothing for unwinding exception
|
// do nothing for unwinding exception
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -107,18 +106,18 @@ pull_coroutine< T >::control_block::valid() const noexcept {
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
pull_coroutine< T & >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
pull_coroutine< T & >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
||||||
rref< Fn > rr, bool preserve_fpu_) :
|
Fn && fn_, bool preserve_fpu_) :
|
||||||
other( nullptr),
|
other( nullptr),
|
||||||
caller( boost::context::execution_context::current() ),
|
caller( boost::context::execution_context::current() ),
|
||||||
callee( palloc, salloc,
|
callee( palloc, salloc,
|
||||||
[=] () mutable {
|
[=,fn=std::forward< Fn >( fn_)] () mutable {
|
||||||
try {
|
try {
|
||||||
// create synthesized push_coroutine< T >
|
// create synthesized push_coroutine< T >
|
||||||
typename push_coroutine< T & >::control_block synthesized_cb( this);
|
typename push_coroutine< T & >::control_block synthesized_cb( this);
|
||||||
push_coroutine< T & > synthesized( & synthesized_cb);
|
push_coroutine< T & > synthesized( & synthesized_cb);
|
||||||
other = & synthesized_cb;
|
other = & synthesized_cb;
|
||||||
// call coroutine-fn with synthesized push_coroutine as argument
|
// call coroutine-fn with synthesized push_coroutine as argument
|
||||||
rr( synthesized);
|
fn( synthesized);
|
||||||
} catch ( forced_unwind const&) {
|
} catch ( forced_unwind const&) {
|
||||||
// do nothing for unwinding exception
|
// do nothing for unwinding exception
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -181,18 +180,18 @@ pull_coroutine< T & >::control_block::valid() const noexcept {
|
|||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
pull_coroutine< void >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
pull_coroutine< void >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
||||||
rref< Fn > rr, bool preserve_fpu_) :
|
Fn && fn_, bool preserve_fpu_) :
|
||||||
other( nullptr),
|
other( nullptr),
|
||||||
caller( boost::context::execution_context::current() ),
|
caller( boost::context::execution_context::current() ),
|
||||||
callee( palloc, salloc,
|
callee( palloc, salloc,
|
||||||
[=] () mutable {
|
[=,fn=std::forward< Fn >( fn_)] () mutable {
|
||||||
try {
|
try {
|
||||||
// create synthesized push_coroutine< T >
|
// create synthesized push_coroutine< T >
|
||||||
typename push_coroutine< void >::control_block synthesized_cb( this);
|
typename push_coroutine< void >::control_block synthesized_cb( this);
|
||||||
push_coroutine< void > synthesized( & synthesized_cb);
|
push_coroutine< void > synthesized( & synthesized_cb);
|
||||||
other = & synthesized_cb;
|
other = & synthesized_cb;
|
||||||
// call coroutine-fn with synthesized push_coroutine as argument
|
// call coroutine-fn with synthesized push_coroutine as argument
|
||||||
rr( synthesized);
|
fn( synthesized);
|
||||||
} catch ( forced_unwind const&) {
|
} catch ( forced_unwind const&) {
|
||||||
// do nothing for unwinding exception
|
// do nothing for unwinding exception
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <boost/context/stack_context.hpp>
|
#include <boost/context/stack_context.hpp>
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
#include <boost/coroutine2/detail/rref.hpp>
|
|
||||||
#include <boost/coroutine2/fixedsize_stack.hpp>
|
#include <boost/coroutine2/fixedsize_stack.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
@ -55,7 +54,7 @@ pull_coroutine< T >::pull_coroutine( StackAllocator salloc, Fn && fn, bool prese
|
|||||||
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
||||||
std::size_t size = sctx.size - sizeof( control_block);
|
std::size_t size = sctx.size - sizeof( control_block);
|
||||||
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
||||||
salloc, rref< Fn >( std::forward< Fn >( fn) ), preserve_fpu);
|
salloc, std::forward< Fn >( fn), preserve_fpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
@ -123,7 +122,7 @@ pull_coroutine< T & >::pull_coroutine( StackAllocator salloc, Fn && fn, bool pre
|
|||||||
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
||||||
std::size_t size = sctx.size - sizeof( control_block);
|
std::size_t size = sctx.size - sizeof( control_block);
|
||||||
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
||||||
salloc, rref< Fn >( std::forward< Fn >( fn) ), preserve_fpu);
|
salloc, std::forward< Fn >( fn), preserve_fpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
@ -183,7 +182,7 @@ pull_coroutine< void >::pull_coroutine( StackAllocator salloc, Fn && fn, bool pr
|
|||||||
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
||||||
std::size_t size = sctx.size - sizeof( control_block);
|
std::size_t size = sctx.size - sizeof( control_block);
|
||||||
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
||||||
salloc, rref< Fn >( std::forward< Fn >( fn) ), preserve_fpu);
|
salloc, std::forward< Fn >( fn), preserve_fpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/context/execution_context.hpp>
|
#include <boost/context/execution_context.hpp>
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/rref.hpp>
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
#endif
|
#endif
|
||||||
@ -33,7 +31,7 @@ struct push_coroutine< T >::control_block {
|
|||||||
T * t;
|
T * t;
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
control_block( context::preallocated, StackAllocator, rref< Fn >, bool);
|
control_block( context::preallocated, StackAllocator, Fn &&, bool);
|
||||||
|
|
||||||
explicit control_block( typename pull_coroutine< T >::control_block *);
|
explicit control_block( typename pull_coroutine< T >::control_block *);
|
||||||
|
|
||||||
@ -60,7 +58,7 @@ struct push_coroutine< T & >::control_block {
|
|||||||
T * t;
|
T * t;
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
control_block( context::preallocated, StackAllocator, rref< Fn >, bool);
|
control_block( context::preallocated, StackAllocator, Fn &&, bool);
|
||||||
|
|
||||||
explicit control_block( typename pull_coroutine< T & >::control_block *);
|
explicit control_block( typename pull_coroutine< T & >::control_block *);
|
||||||
|
|
||||||
@ -83,7 +81,7 @@ struct push_coroutine< void >::control_block {
|
|||||||
std::exception_ptr except;
|
std::exception_ptr except;
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
control_block( context::preallocated, StackAllocator, rref< Fn >, bool);
|
control_block( context::preallocated, StackAllocator, Fn &&, bool);
|
||||||
|
|
||||||
explicit control_block( pull_coroutine< void >::control_block *);
|
explicit control_block( pull_coroutine< void >::control_block *);
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
#include <boost/coroutine2/detail/forced_unwind.hpp>
|
#include <boost/coroutine2/detail/forced_unwind.hpp>
|
||||||
#include <boost/coroutine2/detail/rref.hpp>
|
|
||||||
#include <boost/coroutine2/detail/state.hpp>
|
#include <boost/coroutine2/detail/state.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
@ -33,18 +32,18 @@ namespace detail {
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
push_coroutine< T >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
push_coroutine< T >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
||||||
rref< Fn > rr, bool preserve_fpu_) :
|
Fn && fn_, bool preserve_fpu_) :
|
||||||
other( nullptr),
|
other( nullptr),
|
||||||
caller( boost::context::execution_context::current() ),
|
caller( boost::context::execution_context::current() ),
|
||||||
callee( palloc, salloc,
|
callee( palloc, salloc,
|
||||||
[=] () mutable {
|
[=,fn=std::forward< Fn >( fn_)] () mutable {
|
||||||
try {
|
try {
|
||||||
// create synthesized pull_coroutine< T >
|
// create synthesized pull_coroutine< T >
|
||||||
typename pull_coroutine< T >::control_block synthesized_cb( this);
|
typename pull_coroutine< T >::control_block synthesized_cb( this);
|
||||||
pull_coroutine< T > synthesized( & synthesized_cb);
|
pull_coroutine< T > synthesized( & synthesized_cb);
|
||||||
other = & synthesized_cb;
|
other = & synthesized_cb;
|
||||||
// call coroutine-fn with synthesized pull_coroutine as argument
|
// call coroutine-fn with synthesized pull_coroutine as argument
|
||||||
rr( synthesized);
|
fn( synthesized);
|
||||||
} catch ( forced_unwind const&) {
|
} catch ( forced_unwind const&) {
|
||||||
// do nothing for unwinding exception
|
// do nothing for unwinding exception
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -132,18 +131,18 @@ push_coroutine< T >::control_block::valid() const noexcept {
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
push_coroutine< T & >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
push_coroutine< T & >::control_block::control_block( context::preallocated palloc, StackAllocator salloc,
|
||||||
rref< Fn > rr, bool preserve_fpu_) :
|
Fn && fn_, bool preserve_fpu_) :
|
||||||
other( nullptr),
|
other( nullptr),
|
||||||
caller( boost::context::execution_context::current() ),
|
caller( boost::context::execution_context::current() ),
|
||||||
callee( palloc, salloc,
|
callee( palloc, salloc,
|
||||||
[=] () mutable {
|
[=,fn=std::forward< Fn >( fn_)] () mutable {
|
||||||
try {
|
try {
|
||||||
// create synthesized pull_coroutine< T >
|
// create synthesized pull_coroutine< T >
|
||||||
typename pull_coroutine< T & >::control_block synthesized_cb( this);
|
typename pull_coroutine< T & >::control_block synthesized_cb( this);
|
||||||
pull_coroutine< T & > synthesized( & synthesized_cb);
|
pull_coroutine< T & > synthesized( & synthesized_cb);
|
||||||
other = & synthesized_cb;
|
other = & synthesized_cb;
|
||||||
// call coroutine-fn with synthesized pull_coroutine as argument
|
// call coroutine-fn with synthesized pull_coroutine as argument
|
||||||
rr( synthesized);
|
fn( synthesized);
|
||||||
} catch ( forced_unwind const&) {
|
} catch ( forced_unwind const&) {
|
||||||
// do nothing for unwinding exception
|
// do nothing for unwinding exception
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -208,18 +207,18 @@ push_coroutine< T & >::control_block::valid() const noexcept {
|
|||||||
// push_coroutine< void >
|
// push_coroutine< void >
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
push_coroutine< void >::control_block::control_block( context::preallocated palloc, StackAllocator salloc, rref< Fn > rr, bool preserve_fpu_) :
|
push_coroutine< void >::control_block::control_block( context::preallocated palloc, StackAllocator salloc, Fn && fn_, bool preserve_fpu_) :
|
||||||
other( nullptr),
|
other( nullptr),
|
||||||
caller( boost::context::execution_context::current() ),
|
caller( boost::context::execution_context::current() ),
|
||||||
callee( palloc, salloc,
|
callee( palloc, salloc,
|
||||||
[=] () mutable {
|
[=,fn=std::forward< Fn >( fn_)] () mutable {
|
||||||
try {
|
try {
|
||||||
// create synthesized pull_coroutine< T >
|
// create synthesized pull_coroutine< T >
|
||||||
typename pull_coroutine< void >::control_block synthesized_cb( this);
|
typename pull_coroutine< void >::control_block synthesized_cb( this);
|
||||||
pull_coroutine< void > synthesized( & synthesized_cb);
|
pull_coroutine< void > synthesized( & synthesized_cb);
|
||||||
other = & synthesized_cb;
|
other = & synthesized_cb;
|
||||||
// call coroutine-fn with synthesized pull_coroutine as argument
|
// call coroutine-fn with synthesized pull_coroutine as argument
|
||||||
rr( synthesized);
|
fn( synthesized);
|
||||||
} catch ( forced_unwind const&) {
|
} catch ( forced_unwind const&) {
|
||||||
// do nothing for unwinding exception
|
// do nothing for unwinding exception
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include <boost/context/stack_context.hpp>
|
#include <boost/context/stack_context.hpp>
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
#include <boost/coroutine2/detail/rref.hpp>
|
|
||||||
#include <boost/coroutine2/fixedsize_stack.hpp>
|
#include <boost/coroutine2/fixedsize_stack.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
@ -48,7 +47,7 @@ push_coroutine< T >::push_coroutine( StackAllocator salloc, Fn && fn, bool prese
|
|||||||
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
||||||
std::size_t size = sctx.size - sizeof( control_block);
|
std::size_t size = sctx.size - sizeof( control_block);
|
||||||
cb_= new ( sp) control_block( context::preallocated( sp, size, sctx),
|
cb_= new ( sp) control_block( context::preallocated( sp, size, sctx),
|
||||||
salloc, rref< Fn >( std::forward< Fn >( fn) ), preserve_fpu);
|
salloc, std::forward< Fn >( fn), preserve_fpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
@ -111,7 +110,7 @@ push_coroutine< T & >::push_coroutine( StackAllocator salloc, Fn && fn, bool pre
|
|||||||
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
||||||
std::size_t size = sctx.size - sizeof( control_block);
|
std::size_t size = sctx.size - sizeof( control_block);
|
||||||
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
||||||
salloc, rref< Fn >( std::forward< Fn >( fn) ), preserve_fpu);
|
salloc, std::forward< Fn >( fn), preserve_fpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
@ -165,7 +164,7 @@ push_coroutine< void >::push_coroutine( StackAllocator salloc, Fn && fn, bool pr
|
|||||||
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
void * sp = static_cast< char * >( sctx.sp) - sizeof( control_block);
|
||||||
std::size_t size = sctx.size - sizeof( control_block);
|
std::size_t size = sctx.size - sizeof( control_block);
|
||||||
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
cb_ = new ( sp) control_block( context::preallocated( sp, size, sctx),
|
||||||
salloc, rref< Fn >( std::forward< Fn >( fn) ), preserve_fpu);
|
salloc, std::forward< Fn >( fn), preserve_fpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
|
|
||||||
// Copyright Oliver Kowalke 2013.
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
#ifndef BOOST_COROUTINES2_DETAIL_RREF_H
|
|
||||||
#define BOOST_COROUTINES2_DETAIL_RREF_H
|
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_PREFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace coroutines2 {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
// helper class for capture move-only objects
|
|
||||||
// generalized lambda captures are supported by C++14
|
|
||||||
template< typename Fn >
|
|
||||||
class rref {
|
|
||||||
public:
|
|
||||||
rref( Fn && fn) :
|
|
||||||
fn_( std::forward< Fn >( fn) ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
rref( rref & other) :
|
|
||||||
fn_( std::forward< Fn >( other.fn_) ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
rref( rref && other) :
|
|
||||||
fn_( std::forward< Fn >( other.fn_) ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
rref( rref const& other) = delete;
|
|
||||||
rref & operator=( rref const& other) = delete;
|
|
||||||
|
|
||||||
template< typename S >
|
|
||||||
void operator()( S & s) {
|
|
||||||
return fn_( s);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Fn fn_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}}}
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_SUFFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // BOOST_COROUTINES2_DETAIL_RREF_H
|
|
Loading…
x
Reference in New Issue
Block a user