Class symmetric_coroutine<>::call_type

| Home | Libraries | People | FAQ | More

#### Class `symmetric_coroutine<>::call_type`

    #include <boost/coroutine/symmetric_coroutine.hpp>

    template< typename Arg >
    class symmetric_coroutine<>::call_type
    {
    public:
        call_type() noexcept;

        template< typename Fn >
        call_type( Fn && fn, attributes const& attr = attributes() );

        template< typename Fn, typename StackAllocator >
        call_type( Fn && fn, attributes const& attr, StackAllocator stack_alloc);

        ~call_type();

        call_type( call_type const& other)=delete;

        call_type & operator=( call_type const& other)=delete;

        call_type( call_type && other) noexcept;

        call_type & operator=( call_type && other) noexcept;

        operator unspecified-bool-type() const;

        bool operator!() const noexcept;

        void swap( call_type & other) noexcept;

        call_type & operator()( Arg arg) noexcept;
    };

    template< typename Arg >
    void swap( symmetric_coroutine< Arg >::call_type & l, symmetric_coroutine< Arg >::call_type & r);

###### `call_type()`

Effects:

  Creates a coroutine representing not-a-coroutine.

Throws:

  Nothing.

###### `template< typename Fn > call_type( Fn fn, attributes const& attr)`

Preconditions:

  `size` >= minimum_stacksize(), `size` <= maximum_stacksize() when ! is_stack_unbounded().

Effects:

  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.

###### `template< typename Fn, typename StackAllocator > call_type( Fn && fn, attributes const& attr, StackAllocator const& stack_alloc)`

Preconditions:

  `size` >= minimum_stacksize(), `size` <= maximum_stacksize() when ! is_stack_unbounded().

Effects:

  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.

###### `~call_type()`

Effects:

  Destroys the context and deallocates the stack.

###### `call_type( call_type && other)`

Effects:

  Moves the internal data of `other` to `*this`. `other` becomes not-a-coroutine.

Throws:

  Nothing.

###### `call_type & operator=( call_type && other)`

Effects:

  Destroys the internal data of `*this` and moves the internal data of `other` to `*this`. `other` becomes not-a-coroutine.

Throws:

  Nothing.

###### `operator unspecified-bool-type() const`

Returns:

  If `*this` refers to not-a-coroutine or the coroutine-function has returned (completed), the function returns `false`. Otherwise `true`.

Throws:

  Nothing.

###### `bool operator!() const`

Returns:

  If `*this` refers to not-a-coroutine or the coroutine-function has returned (completed), the function returns `true`. Otherwise `false`.

Throws:

  Nothing.

###### `void swap( call_type & other)`

Effects:

  Swaps the internal data from `*this` with the values of `other`.

Throws:

  Nothing.

###### `call_type & operator()(Arg arg)`

    symmetric_coroutine::call_type& coroutine<Arg,StackAllocator>::call_type::operator()(Arg);
    symmetric_coroutine::call_type& coroutine<Arg&,StackAllocator>::call_type::operator()(Arg&);
    symmetric_coroutine::call_type& coroutine<void,StackAllocator>::call_type::operator()();

Preconditions:

  operator unspecified-bool-type() returns `true` for `*this`.

Effects:

  Execution control is transferred to coroutine-function and the argument `arg` is passed to the coroutine-function.

Throws:

  Nothing.

###### Non-member function `swap()`

    template< typename Arg >
    void swap( symmetric_coroutine< Arg >::call_type & l, symmetric_coroutine< Arg >::call_type & r);

Effects:

  As if 'l.swap( r)'.