Class symmetric_coroutine<>::yield_type

| Home | Libraries | People | FAQ | More

#### Class `symmetric_coroutine<>::yield_type`

    #include <boost/coroutine/symmetric_coroutine.hpp>

    template< typename R >
    class symmetric_coroutine<>::yield_type
    {
    public:
        yield_type() noexcept;

        yield_type( yield_type const& other)=delete;

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

        yield_type( yield_type && other) noexcept;

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

        void swap( yield_type & other) noexcept;

        operator unspecified-bool-type() const;

        bool operator!() const noexcept;

        yield_type & operator()();

        template< typename X >
        yield_type & operator()( symmetric_coroutine< X >::call_type & other, X & x);

        template< typename X >
        yield_type & operator()( symmetric_coroutine< X >::call_type & other);

        R get() const;
    };

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

Returns:

  If `*this` refers to not-a-coroutine, the function returns `false`. Otherwise `true`.

Throws:

  Nothing.

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

Returns:

  If `*this` refers to not-a-coroutine, the function returns `true`. Otherwise `false`.

Throws:

  Nothing.

###### `yield_type & operator()()`

    yield_type & operator()();
    template< typename X >
    yield_type & operator()( symmetric_coroutine< X >::call_type & other, X & x);
    template<>
    yield_type & operator()( symmetric_coroutine< void >::call_type & other);

Preconditions:

  `*this` is not a not-a-coroutine.

Effects:

  The first function transfers execution control back to the starting point, e.g. invocation of symmetric_coroutine<>::call_type::operator(). The last two functions transfer the execution control to another symmetric coroutine. Parameter `x` is passed as value into `other`'s context.

Throws:

  detail::forced_unwind

###### `R get()`

    R    symmetric_coroutine<R>::yield_type::get();
    R&   symmetric_coroutine<R&>::yield_type::get();
    void symmetric_coroutine<void>yield_type::get()=delete;

Preconditions:

  `*this` is not a not-a-coroutine.

Returns:

  Returns data transferred from coroutine-function via symmetric_coroutine<>::call_type::operator().

Throws:

  `invalid_result`