From 1d3fa0583d949ab0d5331b2cbbeddde50fa59146 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Fri, 7 Oct 2016 19:53:23 +0200 Subject: [PATCH] pass ecv2 as universal reference to context-fn --- include/boost/fiber/context.hpp | 10 +++++----- include/boost/fiber/detail/wrap.hpp | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/boost/fiber/context.hpp b/include/boost/fiber/context.hpp index 40cef59d..5bde49be 100644 --- a/include/boost/fiber/context.hpp +++ b/include/boost/fiber/context.hpp @@ -194,7 +194,7 @@ private: #else template< typename Fn, typename Tpl > boost::context::execution_context< detail::data_t * > - run_( boost::context::execution_context< detail::data_t * > ctx, Fn && fn_, Tpl && tpl_, detail::data_t * dp) noexcept { + run_( boost::context::execution_context< detail::data_t * > && ctx, Fn && fn_, Tpl && tpl_, detail::data_t * dp) noexcept { { // fn and tpl must be destroyed before calling set_terminated() typename std::decay< Fn >::type fn = std::forward< Fn >( fn_); @@ -336,8 +336,8 @@ public: ctx_{ std::allocator_arg, palloc, salloc, detail::wrap( [this]( typename std::decay< Fn >::type & fn, typename std::decay< Tpl >::type & tpl, - boost::context::execution_context< detail::data_t * > ctx, detail::data_t * dp) mutable noexcept { - return run_( std::move( ctx), std::move( fn), std::move( tpl), dp); + boost::context::execution_context< detail::data_t * > && ctx, detail::data_t * dp) mutable noexcept { + return run_( std::forward< boost::context::execution_context< detail::data_t * > >( ctx), std::move( fn), std::move( tpl), dp); }, std::forward< Fn >( fn), std::forward< Tpl >( tpl) )} @@ -345,8 +345,8 @@ public: # else ctx_{ std::allocator_arg, palloc, salloc, [this,fn=detail::decay_copy( std::forward< Fn >( fn) ),tpl=std::forward< Tpl >( tpl)] - (boost::context::execution_context< detail::data_t * > ctx, detail::data_t * dp) mutable noexcept { - return run_( std::move( ctx), std::move( fn), std::move( tpl), dp); + (boost::context::execution_context< detail::data_t * > && ctx, detail::data_t * dp) mutable noexcept { + return run_( std::forward< boost::context::execution_context< detail::data_t * > >( ctx), std::move( fn), std::move( tpl), dp); }} # endif #endif diff --git a/include/boost/fiber/detail/wrap.hpp b/include/boost/fiber/detail/wrap.hpp index 850763b4..0369e61e 100644 --- a/include/boost/fiber/detail/wrap.hpp +++ b/include/boost/fiber/detail/wrap.hpp @@ -87,10 +87,13 @@ public: wrapper & operator=( wrapper && other) = default; boost::context::execution_context< data_t * > - operator()( boost::context::execution_context< data_t * > ctx, data_t * dp) { + operator()( boost::context::execution_context< data_t * > && ctx, data_t * dp) { return boost::context::detail::invoke( std::move( fn1_), - fn2_, tpl_, std::move( ctx), dp); + fn2_, + tpl_, + std::forward< boost::context::execution_context< data_t * > >( ctx), + dp); } };