C/C++ API Reference
Loading...
Searching...
No Matches
Pendable adapters

Overview

Pendable wrappers and helpers.

Classes

class  pw::async2::FutureCallbackTask< FutureType, Func >
 
class  pw::async2::PendFuncAwaitable< T, Func >
 
class  pw::async2::PendFuncTask< Func >
 
class  pw::async2::MemberPendableWrapper< Func >
 
class  pw::async2::FreePendableWrapper< Func >
 
class  pw::async2::PendableAsTask< Pendable >
 

Functions

template<typename FutureType , typename Func >
 pw::async2::FutureCallbackTask (FutureType &&, Func &&) -> FutureCallbackTask< FutureType, Func >
 
template<typename Callable >
 pw::async2::PendFuncAwaitable (Callable) -> PendFuncAwaitable< typename std::invoke_result< Callable, Context & >::type::value_type, typename std::remove_reference< Callable >::type >
 
template<typename Func >
 pw::async2::PendFuncTask (Func &&) -> PendFuncTask< Func >
 
template<auto MemberFunc, typename Traits = internal::PendableTraits<decltype(MemberFunc)>, typename = std::enable_if_t< Traits::kIsPendable && std::is_member_function_pointer_v<decltype(MemberFunc)>>, typename... Args>
constexpr MemberPendableWrapper< MemberFunc > pw::async2::PendableFor (typename Traits::Class &obj, Args &&... args)
 
template<auto FreeFunc, typename Traits = internal::PendableTraits<decltype(FreeFunc)>, typename = std::enable_if_t< Traits::kIsPendable && !std::is_member_function_pointer_v<decltype(FreeFunc)>>, typename... Args>
constexpr FreePendableWrapper< FreeFunc > pw::async2::PendableFor (Args &&... args)
 
template<typename T >
 pw::async2::PendableAsTask (T &&) -> PendableAsTask< T >
 

Function Documentation

◆ PendableFor() [1/2]

template<auto FreeFunc, typename Traits = internal::PendableTraits<decltype(FreeFunc)>, typename = std::enable_if_t< Traits::kIsPendable && !std::is_member_function_pointer_v<decltype(FreeFunc)>>, typename... Args>
constexpr FreePendableWrapper< FreeFunc > pw::async2::PendableFor ( Args &&...  args)
inlineconstexpr

Wraps a pendable free function in an object which has a single Pend method, allowing it to be used more broadly.

The wrapper stores the arguments used to invoke the target function. As a result, the argument types must be copyable.

The wrapping pendable object can only be used a single time. After its Pend method returns Ready, it will crash if called again.

◆ PendableFor() [2/2]

template<auto MemberFunc, typename Traits = internal::PendableTraits<decltype(MemberFunc)>, typename = std::enable_if_t< Traits::kIsPendable && std::is_member_function_pointer_v<decltype(MemberFunc)>>, typename... Args>
constexpr MemberPendableWrapper< MemberFunc > pw::async2::PendableFor ( typename Traits::Class &  obj,
Args &&...  args 
)
inlineconstexpr

Wraps a pendable member function in an object which has a single Pend method, allowing it to be used more broadly.

The wrapper stores the arguments used to invoke the target function. As a result, the argument types must be copyable.

The wrapping pendable object can only be used a single time. After its Pend method returns Ready, it will crash if called again.