Condy v1.1.0
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
condy::Coro< T, Allocator > Class Template Reference

Coroutine type used to define a coroutine function. More...

#include <coro.hpp>

Public Member Functions

auto operator co_await () noexcept
 Wait for the coroutine to complete and get the result.

Detailed Description

template<typename T = void, typename Allocator = void>
class condy::Coro< T, Allocator >

Coroutine type used to define a coroutine function.

Template Parameters
TReturn type of the coroutine.
AllocatorAllocator type used for memory management, default is void, which means use the default allocator.

User can define a coroutine function by specifying this type as the return type. The coroutine function will return an instance of this type. The coroutine can be awaited using the co_await operator, or can be spawned as a task using co_spawn().

Member Function Documentation

◆ operator co_await()

template<typename T, typename Allocator>
auto condy::Coro< T, Allocator >::operator co_await ( )
inlinenoexcept

Wait for the coroutine to complete and get the result.

User can use co_await operator to await the completion of the coroutine and get the result. The behavior is similar to a normal function call.

Returns
The result of the coroutine, with type T.

The documentation for this class was generated from the following files: