summaryrefslogtreecommitdiff
path: root/boost/context/continuation_fcontext.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/context/continuation_fcontext.hpp')
-rw-r--r--boost/context/continuation_fcontext.hpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/boost/context/continuation_fcontext.hpp b/boost/context/continuation_fcontext.hpp
index 461933fda5..03f8f6a644 100644
--- a/boost/context/continuation_fcontext.hpp
+++ b/boost/context/continuation_fcontext.hpp
@@ -138,7 +138,7 @@ public:
Ctx c{ fctx };
// invoke context-function
#if defined(BOOST_NO_CXX17_STD_INVOKE)
- c = invoke( fn_, std::move( c) );
+ c = boost::context::detail::invoke( fn_, std::move( c) );
#else
c = std::invoke( fn_, std::move( c) );
#endif
@@ -238,7 +238,7 @@ public:
}
continuation( continuation && other) noexcept {
- std::swap( fctx_, other.fctx_);
+ swap( other);
}
continuation & operator=( continuation && other) noexcept {
@@ -252,29 +252,38 @@ public:
continuation( continuation const& other) noexcept = delete;
continuation & operator=( continuation const& other) noexcept = delete;
- continuation resume() {
+ continuation resume() & {
+ return std::move( * this).resume();
+ }
+
+ continuation resume() && {
BOOST_ASSERT( nullptr != fctx_);
- return detail::jump_fcontext(
+ return { detail::jump_fcontext(
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
detail::exchange( fctx_, nullptr),
#else
std::exchange( fctx_, nullptr),
#endif
- nullptr).fctx;
+ nullptr).fctx };
+ }
+
+ template< typename Fn >
+ continuation resume_with( Fn && fn) & {
+ return std::move( * this).resume_with( std::forward< Fn >( fn) );
}
template< typename Fn >
- continuation resume_with( Fn && fn) {
+ continuation resume_with( Fn && fn) && {
BOOST_ASSERT( nullptr != fctx_);
auto p = std::make_tuple( std::forward< Fn >( fn) );
- return detail::ontop_fcontext(
+ return { detail::ontop_fcontext(
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
detail::exchange( fctx_, nullptr),
#else
std::exchange( fctx_, nullptr),
#endif
& p,
- detail::context_ontop< continuation, Fn >).fctx;
+ detail::context_ontop< continuation, Fn >).fctx };
}
explicit operator bool() const noexcept {