...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/coroutine/coroutine.hpp> template< typename R > class coroutine<>::pull_type { public: pull_type(); template< typename Fn, typename StackAllocator = stack_allocator, typename Allocator = std::allocator< coroutine > > pull_type( Fn fn, attributes const& attr = attributes(), StackAllocator const& stack_alloc = StackAllocator(), Allocator const& alloc = Allocator() ); template< typename Fn, typename StackAllocator = stack_allocator, typename Allocator = std::allocator< coroutine > > pull_type( Fn && fn, attributes const& attr = attributes(), StackAllocator stack_alloc = StackAllocator(), Allocator const& alloc = Allocator() ); pull_type( pull_type && other); pull_type & operator=( pull_type && other); operator unspecified-bool-type() const; bool operator!() const; void swap( pull_type & other); bool empty() const; pull_type & operator()(); bool has_result() const; R get() const; }; template< typename R > void swap( pull_type< R > & l, pull_type< R > & r); template< typename R > range_iterator< pull_type< R > >::type begin( pull_type< R > &); template< typename R > range_iterator< pull_type< R > >::type end( pull_type< R > &);
pull_type()
Creates a coroutine representing not-a-coroutine.
Nothing.
template< typename Fn, typename StackAllocator,
typename Allocator
> pull_type( Fn fn, attributes const& attr, StackAllocator
const&
stack_alloc,
Allocator const& alloc)
size
> minimum_stacksize(),
size
< maximum_stacksize()
when ! is_stack_unbound().
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 and internal data are allocated by Allocator.
Exceptions thrown inside coroutine-function.
template< typename Fn, typename StackAllocator,
typename Allocator
> pull_type( Fn && fn, attributes
const&
attr,
StackAllocator const& stack_alloc, Allocator
const&
alloc)
size
> minimum_stacksize(),
size
< maximum_stacksize()
when ! is_stack_unbound().
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 and internal data are allocated by Allocator.
Exceptions thrown inside coroutine-function.
pull_type(
pull_type &&
other)
Moves the internal data of other
to *this
.
other
becomes not-a-coroutine.
Nothing.
pull_type &
operator=(
pull_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.
bool empty()
If *this
refers to not-a-coroutine, the function returns
true. Otherwise false.
Nothing.
pull_type<>
& operator()()
*this
is not a not-a-coroutine.
Execution control is transferred to coroutine-function (no parameter are passed to the coroutine-function).
Exceptions thrown inside coroutine-function.
bool has_result()
*this
is not a not-a-coroutine.
If *this
has a, the function returns true. Otherwise false.
Nothing.
R get()()
R coroutine<R>::pull_type::get(); R& coroutine<R&>::pull_type::get(); void coroutine<void>pull_type::get()=delete;
*this
is not a not-a-coroutine.
Returns data transferred from coroutine-function via boost::coroutines::coroutine<>::push_type::operator().
Nothing.
void swap( pull_type
& other)
Swaps the internal data from *this
with the values of other
.
Nothing.
swap()
template< typename R > void swap( pull_type< R > & l, pull_type< R > & r);
As if 'l.swap( r)'.
begin(
pull_type<
R >
&)
template< typename R > range_iterator< pull_type< R > >::type begin( pull_type< R > &);
Returns a range-iterator (input-iterator).
end(
pull_type<
R >
&)
template< typename R > range_iterator< pull_type< R > >::type end( pull_type< R > &);
Returns a end range-iterator (input-iterator).