16 #ifndef ZYPP_ZYPPNG_MONADIC_MTRY_H 17 #define ZYPP_ZYPPNG_MONADIC_MTRY_H 25 ,
typename Ret = std::invoke_result_t<F, Args...>
26 ,
typename Exp = expected<Ret, std::exception_ptr>
28 Exp
mtry(F &&f, Args&& ...args)
31 if constexpr ( std::is_same_v<void, Ret> ) {
32 std::invoke(std::forward<F>(f), std::forward<Args>(args)... );
45 template <
typename Callback>
49 template <
typename ...Args >
51 return mtry(
function, std::forward<Args>(args)... );
57 template <
typename Fun>
58 auto mtry ( Fun &&
function ) {
59 return ::zyppng::detail::mtry_helper<Fun> {
60 std::forward<Fun>(
function)
auto mtry(Fun &&function)
std::enable_if< std::is_member_pointer< typename std::decay< Functor >::type >::value, typename std::result_of< Functor &&(Args &&...)>::type >::type invoke(Functor &&f, Args &&... args)
auto operator()(Args &&...args)
Exp mtry(F &&f, Args &&...args)
static expected success(ConsParams &&...params)
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.