mp-coro main
Coroutine support tools
Namespaces | Classes | Concepts | Typedefs | Functions
mp_coro Namespace Reference

Namespaces

namespace  detail
 

Classes

class  async
 
struct  coro_deleter
 If the given promise object has an associated coroutine, destroy it. More...
 
class  generator
 
struct  remove_rvalue_reference
 
struct  remove_rvalue_reference< T && >
 
class  task
 Task that produces a value of type T: to get that value, simply await the task. More...
 
struct  void_type
 

Concepts

concept  specialization_of
 
concept  awaiter
 
concept  awaiter_of
 
concept  awaitable
 
concept  awaitable_of
 
concept  task_value_type
 
concept  sync_notification_type
 Type that supports the notify_awaitable_completed() member function used by mp_coro::detail::synchronized_task.
 

Typedefs

template<typename T >
using nonvoid_await_result_t = std::conditional_t< std::is_void_v< await_result_t< T > >, void_type, await_result_t< T > >
 
template<typename T >
using remove_rvalue_reference_t = typename remove_rvalue_reference< T >::type
 
template<typename T >
using promise_ptr = std::unique_ptr< T, coro_deleter >
 RAII wrapper that destroys promise object's associated coroutine. More...
 
template<awaitable A>
using awaiter_for_t = decltype(detail::get_awaiter(std::declval< A >()))
 
template<awaitable A>
using await_result_t = decltype(std::declval< awaiter_for_t< A > >().await_resume())
 

Functions

template<typename F >
 async (F) -> async< F >
 
template<awaitable A>
decltype(auto) sync_await (A &&awaitable)
 Creates a synchronized task from the awaitable, starts it, and waits for it to complete, returning the result. More...
 
template<awaitable... Awaitables>
awaitable auto when_all (Awaitables &&...awaitables)
 
template<std::ranges::range R>
awaitable auto when_all (R &&awaitables)
 

Class Documentation

◆ mp_coro::remove_rvalue_reference

struct mp_coro::remove_rvalue_reference
+ Collaboration diagram for remove_rvalue_reference< T >:
Class Members
typedef T type

◆ mp_coro::remove_rvalue_reference< T && >

struct mp_coro::remove_rvalue_reference< T && >
+ Collaboration diagram for remove_rvalue_reference< T && >:
Class Members
typedef T type

◆ mp_coro::void_type

struct mp_coro::void_type
+ Collaboration diagram for void_type:

Typedef Documentation

◆ nonvoid_await_result_t

using nonvoid_await_result_t = std::conditional_t<std::is_void_v<await_result_t<T> >, void_type, await_result_t<T> >

Definition at line 33 of file nonvoid_storage.h.

◆ remove_rvalue_reference_t

Definition at line 53 of file bits/type_traits.h.

◆ promise_ptr

using promise_ptr = std::unique_ptr<T, coro_deleter>

RAII wrapper that destroys promise object's associated coroutine.

Definition at line 44 of file coro_ptr.h.

◆ awaiter_for_t

using awaiter_for_t = decltype(detail::get_awaiter(std::declval<A>()))

Definition at line 32 of file type_traits.h.

◆ await_result_t

using await_result_t = decltype(std::declval<awaiter_for_t<A> >().await_resume())

Definition at line 35 of file type_traits.h.

Function Documentation

◆ async()

async ( ) -> async< F >

◆ sync_await()

decltype(auto) sync_await ( A &&  awaitable)

Creates a synchronized task from the awaitable, starts it, and waits for it to complete, returning the result.

Uses a std::binary_semaphore for waiting and synchronization.

Examples
sleep_for.cpp.

Definition at line 36 of file sync_await.h.

◆ when_all() [1/2]

awaitable auto when_all ( Awaitables &&...  awaitables)

Definition at line 165 of file when_all.h.

◆ when_all() [2/2]

awaitable auto when_all ( R &&  awaitables)

Definition at line 173 of file when_all.h.