16 #ifndef ZYPP_ZYPPNG_MONADIC_MTRY_H 17 #define ZYPP_ZYPPNG_MONADIC_MTRY_H 21 #include <zypp-core/ng/pipelines/operators.h> 27 template <
typename Ret,
typename F,
typename ...Args >
32 if constexpr ( std::is_same_v<void, Ret> ) {
33 std::invoke(std::forward<F>(f), std::forward<Args>(args)... );
47 ,
typename Ret = std::invoke_result_t<F, Args...>
48 ,
typename Exp = expected<Ret, std::exception_ptr>
50 auto mtry(F &&f, Args&& ...args)
58 template <
typename Callback>
62 template <
typename ...Args >
64 return mtry(
function, std::forward<Args>(args)... );
70 template <
typename Fun>
71 auto mtry ( Fun &&
function ) {
72 return ::zyppng::detail::mtry_helper<Fun> {
73 std::forward<Fun>(
function)
79 #ifdef ZYPP_ENABLE_ASYNC 80 #include <zypp-core/ng/async/pipelines/mtry.hpp>
static expected< Ret > execute(F &&f, Args &&...args)
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)
static expected success(ConsParams &&...params)
auto mtry(F &&f, Args &&...args)
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.