summaryrefslogtreecommitdiff
path: root/boost/context/continuation_fcontext.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
commitb8cf34c691623e4ec329053cbbf68522a855882d (patch)
tree34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/context/continuation_fcontext.hpp
parent3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff)
downloadboost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz
boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2
boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip
Imported Upstream version 1.67.0upstream/1.67.0
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 {