wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
wwa::coro Namespace Reference

Library namespace. More...

Classes

class  async_generator
 An asynchronous generator that produces values of type Result. More...
 
class  bad_result_access
 Exception thrown when accessing a result that is not available. More...
 
class  bad_task
 Exception thrown when a coroutine task is invalid. More...
 
class  eager_task
 Eager coroutine. More...
 
class  generator
 An synchronous generator that produces values of type Result. More...
 
class  sync_generator_adapter
 Adapter for converting asynchronous generators to synchronous generators. More...
 
class  task
 A coroutine task. More...
 

Functions

template<typename Awaitable, typename... Args>
eager_task run_awaitable (Awaitable &&f, Args &&... args)
 Turns any awaitable into an eager fire-and-forget coroutine.
 
template<typename Result>
 sync_generator_adapter (async_generator< Result >) -> sync_generator_adapter< Result >
 Deduction guide for sync_generator_adapter.
 

Detailed Description

Library namespace.

Function Documentation

◆ run_awaitable()

template<typename Awaitable, typename... Args>
eager_task wwa::coro::run_awaitable ( Awaitable && f,
Args &&... args )

Turns any awaitable into an eager fire-and-forget coroutine.

This method template takes an awaitable callable and its arguments, invokes the callable with the provided arguments, and co_await's the result. It effectively runs the awaitable in a fire-and-forget manner.

Template Parameters
AwaitableThe type of the awaitable callable.
ArgsThe types of the arguments to be passed to the callable.
Parameters
fThe awaitable callable to be invoked.
argsThe arguments to be passed to the callable.
Returns
A fire-and-forget task.
Examples
run_awaitable.cpp, and task.cpp.

Definition at line 130 of file eager_task.h.

◆ sync_generator_adapter()

template<typename Result>
wwa::coro::sync_generator_adapter ( async_generator< Result > ) -> sync_generator_adapter< Result >

Deduction guide for sync_generator_adapter.

This deduction guide allows the sync_generator_adapter class to be constructed without explicitly specifying the template argument.

Template Parameters
ResultThe type of the elements produced by the generator.
Examples
advance_with_begin.cpp.