![]() |
Home | Libraries | People | FAQ | More |
#include <boost/context/continuation.hpp> class continuation { public: continuation() noexcept = default; ~continuation(); continuation(continuation && other) noexcept; continuation & operator=(continuation && other) noexcept; continuation(continuation const& other) noexcept = delete; continuation & operator=(continuation const& other) noexcept = delete; template<typename ...Arg> continuation resume(Arg ...arg); template<typename Fn,typename ...Arg> continuation resume_with(Fn && fn,Arg ...arg); bool data_available() noexcept; template<typename ...Arg> <unspecified> get_data(); explicit operator bool() const noexcept; bool operator!() const noexcept; bool operator==(continuation const& other) const noexcept; bool operator!=(continuation const& other) const noexcept; bool operator<(continuation const& other) const noexcept; bool operator>(continuation const& other) const noexcept; bool operator<=(continuation const& other) const noexcept; bool operator>=(continuation const& other) const noexcept; template<typename charT,class traitsT> friend std::basic_ostream<charT,traitsT> & operator<<(std::basic_ostream<charT,traitsT> & os,continuation const& other) { void swap(continuation & other) noexcept; };
continuation() noexcept;
Creates a invalid continuation.
Nothing.
~continuation();
Destructs the associated stack if *this
is a valid continuation, e.g.
continuation::operator bool() returns true
.
Nothing.
continuation(continuation && other) noexcept;
Moves underlying capture continuation to *this
.
Nothing.
continuation & operator=(continuation && other) noexcept;
Moves the state of other
to *this
using move semantics.
Nothing.
operator()
()
template<typename ...Arg> continuation resume(Arg ...arg); template<typename Fn,typename ...Arg> continuation resume_with(Fn && fn,Arg ...arg);
Captures current continuation and resumes *this
. The function with argument type
exec_ontop_arg
, is
used to execute function fn
in continuation *this
(e.g. the stack frame of fn
is allocated on stack of *this
).
The continuation representing the continuation that has been suspended.
The returned arguments from fn
are passed as arguments to the context-function of resumed continuation.
Function fn
needs to
return a tuple of arguments (see description).
The returned continuation indicates if the suspended continuation has
terminated (return from context-function) via bool
operator()
.
If the returned continuation has terminated no data are transferred.
data_available
()
bool data_available() noexcept;
Tests if c
has data.
true
if data have been
transferred, otherwise false
.
Nothing.
get_available
()
template<typename ...Arg> <unspecified> get_data();
Data that have been transferred via callcc()
or operator()
are returned as std::tuple<Arg...>
or Arg
if single parameter.
operator bool
()
explicit operator bool() const noexcept;
true
if *this
points to a captured continuation.
Nothing.
operator!
()
bool operator!() const noexcept;
true
if *this
does not point to a captured continuation.
Nothing.
operator==
()
bool operator==(continuation const& other) const noexcept;
true
if *this
and other
represent
the same continuation, false
otherwise.
Nothing.
operator!=
()
bool operator!=(continuation const& other) const noexcept;
! (other == * this)
Nothing.
operator<
()
bool operator<(continuation const& other) const noexcept;
true
if *this != other
is true and the implementation-defined total order of continuation
values places *this
before other
, false
otherwise.
Nothing.
operator>
()
bool operator>(continuation const& other) const noexcept;
other <
* this
Nothing.
operator<=
()
bool operator<=(continuation const& other) const noexcept;
! (other <
* this)
Nothing.
operator>=
()
bool operator>=(continuation const& other) const noexcept;
! (*
this <
other)
Nothing.
operator<<()
template<typename charT,class traitsT> std::basic_ostream<charT,traitsT> & operator<<(std::basic_ostream<charT,traitsT> & os,continuation const& other);
Writes the representation of other
to stream os
.
os
#include <boost/context/continuation.hpp> template<typename Fn,typename ...Arg> continuation callcc(Fn && fn,Arg ...arg); template<typename StackAlloc,typename Fn,typename ...Arg> continuation callcc(std::allocator_arg_t,StackAlloc salloc,Fn && fn,Arg ...arg); template<typename StackAlloc,typename Fn,typename ...Arg> continuation callcc(std::allocator_arg_t,preallocated palloc,StackAlloc salloc,Fn && fn,Arg ...arg);
Captures current continuation and creates a new continuation prepared
to execute fn
. fixedsize_stack
is used as default
stack allocator (stack size == fixedsize_stack::traits::default_size()).
The function with argument type preallocated
,
is used to create a user defined data (for
instance additional control structures) on top of the stack.
The arguments, ... arg
,
are passed to the current continuation to be transferred by the call
to callcc()
in the same thread.
The continuation representing the contexcontinuation that has been suspended.
The returned continuation indicates if the suspended continuation has
terminated (return from context-function) via bool
operator()
.
If the returned continuation has terminated no data are transferred.