template <class ErrType, class Fun, class... Args>
constexpr auto try_wrap(Fun&& fun, Args&&... args)
-> result<std::invoke_result_t<Fun, Args...>,
ErrType>
template <class ErrType, class Fun, class... Args>
constexpr auto try_wrap(Fun&& fun, Args&&... args)
-> result<std::invoke_result_t<Fun, Args...>,
ErrType>
Description
Wrap a call that throws an exception and returns it as a result.
Calls a function that may throw an exception and transform the return type into a result monad that contains either the return type of the function, or the exception type.
Declared at: libreglisse/try.hpp:26
Parameters
- Fun&& fun
- The function to call.
- Args&&... args
- The arguments of the function.