3#include <yaclib/config.hpp>
10template <
typename Func>
13 using Store = std::decay_t<Func>;
14 using Invoke = std::conditional_t<std::is_function_v<std::remove_reference_t<Func>>,
Store,
Func>;
16 explicit SafeCall(
Store&&
f)
noexcept(std::is_nothrow_move_constructible_v<Store>) : _func{std::
move(
f)} {
19 explicit SafeCall(
const Store&
f)
noexcept(std::is_nothrow_copy_constructible_v<Store>) : _func{
f} {
24 if constexpr (std::is_nothrow_invocable_v<Invoke>) {
25 std::forward<Invoke>(_func)();
28 std::forward<Invoke>(_func)();
std::decay_t< Func > Store
SafeCall(const Store &f) noexcept(std::is_nothrow_copy_constructible_v< Store >)
std::conditional_t< std::is_function_v< std::remove_reference_t< Func > >, Store, Func > Invoke
SafeCall(Store &&f) noexcept(std::is_nothrow_move_constructible_v< Store >)
Contract< V, E > MakeContract()
Creates related future and promise.