summaryrefslogtreecommitdiff
path: root/boost/context/execution_context_v2_void.ipp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/context/execution_context_v2_void.ipp')
-rw-r--r--boost/context/execution_context_v2_void.ipp28
1 files changed, 14 insertions, 14 deletions
diff --git a/boost/context/execution_context_v2_void.ipp b/boost/context/execution_context_v2_void.ipp
index 6e8f85a8dc..bab713639a 100644
--- a/boost/context/execution_context_v2_void.ipp
+++ b/boost/context/execution_context_v2_void.ipp
@@ -10,21 +10,21 @@ template< typename Ctx, typename Fn >
transfer_t context_ontop_void( transfer_t);
template< typename Ctx, typename StackAlloc, typename Fn, typename ... Params >
-fcontext_t context_create_void( StackAlloc, Fn &&, Params && ...);
+fcontext_t context_create_void( StackAlloc &&, Fn &&, Params && ...);
template< typename Ctx, typename StackAlloc, typename Fn, typename ... Params >
-fcontext_t context_create_void( preallocated, StackAlloc, Fn &&, Params && ...);
+fcontext_t context_create_void( preallocated, StackAlloc &&, Fn &&, Params && ...);
template< typename Ctx, typename StackAlloc, typename Fn, typename ... Params >
class record_void {
private:
- StackAlloc salloc_;
+ typename std::decay< StackAlloc >::type salloc_;
stack_context sctx_;
typename std::decay< Fn >::type fn_;
std::tuple< typename std::decay< Params >::type ... > params_;
static void destroy( record_void * p) noexcept {
- StackAlloc salloc = p->salloc_;
+ typename std::decay< StackAlloc >::type salloc = std::move( p->salloc_);
stack_context sctx = p->sctx_;
// deallocate record
p->~record_void();
@@ -33,9 +33,9 @@ private:
}
public:
- record_void( stack_context sctx, StackAlloc const& salloc,
+ record_void( stack_context sctx, StackAlloc && salloc,
Fn && fn, Params && ... params) noexcept :
- salloc_( salloc),
+ salloc_( std::forward< StackAlloc >( salloc) ),
sctx_( sctx),
fn_( std::forward< Fn >( fn) ),
params_( std::forward< Params >( params) ... ) {
@@ -111,14 +111,14 @@ public:
typename Fn,
typename ... Params
>
- execution_context( std::allocator_arg_t, StackAlloc salloc, Fn && fn, Params && ... params) :
+ execution_context( std::allocator_arg_t, StackAlloc && salloc, Fn && fn, Params && ... params) :
// deferred execution of fn and its arguments
// arguments are stored in std::tuple<>
// non-type template parameter pack via std::index_sequence_for<>
// preserves the number of arguments
// used to extract the function arguments from std::tuple<>
fctx_( detail::context_create_void< execution_context >(
- salloc,
+ std::forward< StackAlloc >( salloc),
std::forward< Fn >( fn),
std::forward< Params >( params) ... ) ) {
}
@@ -127,14 +127,14 @@ public:
typename Fn,
typename ... Params
>
- execution_context( std::allocator_arg_t, preallocated palloc, StackAlloc salloc, Fn && fn, Params && ... params) :
+ execution_context( std::allocator_arg_t, preallocated palloc, StackAlloc && salloc, Fn && fn, Params && ... params) :
// deferred execution of fn and its arguments
// arguments are stored in std::tuple<>
// non-type template parameter pack via std::index_sequence_for<>
// preserves the number of arguments
// used to extract the function arguments from std::tuple<>
fctx_( detail::context_create_void< execution_context >(
- palloc, salloc,
+ palloc, std::forward< StackAlloc >( salloc),
std::forward< Fn >( fn),
std::forward< Params >( params) ... ) ) {
}
@@ -260,7 +260,7 @@ transfer_t context_ontop_void( transfer_t t) {
}
template< typename Ctx, typename StackAlloc, typename Fn, typename ... Params >
-fcontext_t context_create_void( StackAlloc salloc, Fn && fn, Params && ... params) {
+fcontext_t context_create_void( StackAlloc && salloc, Fn && fn, Params && ... params) {
typedef record_void< Ctx, StackAlloc, Fn, Params ... > record_t;
auto sctx = salloc.allocate();
@@ -285,13 +285,13 @@ fcontext_t context_create_void( StackAlloc salloc, Fn && fn, Params && ... param
BOOST_ASSERT( nullptr != fctx);
// placment new for control structure on context-stack
auto rec = ::new ( sp) record_t{
- sctx, salloc, std::forward< Fn >( fn), std::forward< Params >( params) ... };
+ sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn), std::forward< Params >( params) ... };
// transfer control structure to context-stack
return jump_fcontext( fctx, rec).fctx;
}
template< typename Ctx, typename StackAlloc, typename Fn, typename ... Params >
-fcontext_t context_create_void( preallocated palloc, StackAlloc salloc, Fn && fn, Params && ... params) {
+fcontext_t context_create_void( preallocated palloc, StackAlloc && salloc, Fn && fn, Params && ... params) {
typedef record_void< Ctx, StackAlloc, Fn, Params ... > record_t;
// reserve space for control structure
@@ -315,7 +315,7 @@ fcontext_t context_create_void( preallocated palloc, StackAlloc salloc, Fn && fn
BOOST_ASSERT( nullptr != fctx);
// placment new for control structure on context-stack
auto rec = ::new ( sp) record_t{
- palloc.sctx, salloc, std::forward< Fn >( fn), std::forward< Params >( params) ... };
+ palloc.sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn), std::forward< Params >( params) ... };
// transfer control structure to context-stack
return jump_fcontext( fctx, rec).fctx;
}