...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
#include <boost/coroutine2/coroutine.hpp> template< typename Arg > class coroutine<>::push_type { public: push_type() noexcept; template< typename Fn > push_type( Fn && fn, attributes const& attr = attributes() ); template< typename Fn, typename StackAllocator > push_type( Fn && fn, attributes const& attr, StackAllocator stack_alloc); push_type( push_type const& other)=delete; push_type & operator=( push_type const& other)=delete; ~push_type(); push_type( push_type && other) noexcept; push_type & operator=( push_type && other) noexcept; operator unspecified-bool-type() const noexcept; bool operator!() const noexcept; void swap( push_type & other) noexcept; push_type & operator()( Arg arg); }; template< typename Arg > void swap( push_type< Arg > & l, push_type< Arg > & r); template< typename Arg > range_iterator< push_type< Arg > >::type begin( push_type< Arg > &); template< typename Arg > range_iterator< push_type< Arg > >::type end( push_type< Arg > &);
push_type()
Creates a coroutine representing not-a-coroutine.
Nothing.
template< typename Fn
> push_type( Fn && fn, attributes
const&
attr)
size
>= minimum_stacksize(),
size
<= maximum_stacksize()
when ! is_stack_unbounded().
Creates a coroutine which will execute fn
.
Argument attr
determines
stack clean-up and preserving floating-point registers.
template< typename Fn, typename StackAllocator >
push_type(
Fn &&
fn,
attributes const& attr, StackAllocator
const&
stack_alloc)
size
>= minimum_stacksize(),
size
<= maximum_stacksize()
when ! is_stack_unbounded().
Creates a coroutine which will execute fn
.
Argument attr
determines
stack clean-up and preserving floating-point registers. For allocating/deallocating
the stack stack_alloc
is used.
~push_type()
Destroys the context and deallocates the stack.
push_type(
push_type &&
other)
Moves the internal data of other
to *this
.
other
becomes not-a-coroutine.
Nothing.
push_type &
operator=(
push_type &&
other)
Destroys the internal data of *this
and moves the internal data of
other
to *this
.
other
becomes not-a-coroutine.
Nothing.
operator unspecified-bool-type() const
If *this
refers to not-a-coroutine or the coroutine-function
has returned (completed), the function returns false
.
Otherwise true
.
Nothing.
bool operator!() const
If *this
refers to not-a-coroutine or the coroutine-function
has returned (completed), the function returns true
.
Otherwise false
.
Nothing.
push_type &
operator()(Arg arg)
push_type& coroutine<Arg>::push_type::operator()(Arg); push_type& coroutine<Arg&>::push_type::operator()(Arg&); push_type& coroutine<void>::push_type::operator()();
operator unspecified-bool-type() returns true
for *this
.
Execution control is transferred to coroutine-function
and the argument arg
is passed to the coroutine-function.
Exceptions thrown inside coroutine-function.
void swap( push_type
& other)
Swaps the internal data from *this
with the values of other
.
Nothing.
swap()
template< typename Arg > void swap( push_type< Arg > & l, push_type< Arg > & r);
As if 'l.swap( r)'.
begin(
push_type<
Arg >
&)
template< typename Arg > range_iterator< push_type< Arg > >::type begin( push_type< Arg > &);
Returns a range-iterator (output-iterator).
end(
push_type<
Arg >
&)
template< typename Arg > range_iterator< push_type< Arg > >::type end( push_type< Arg > &);
Returns a end range-iterator (output-iterator).
When first obtained from begin( push_type< R
> &)
,
or after some number of increment operations, an iterator will compare
equal to the iterator returned by end( push_type< R
> &)
when the corresponding coroutine<>::push_type::operator
bool would return false
.