Template Function rsl::mtry

Function Documentation

template<typename Fn> auto rsl::mtry (Fn fn) -> tl::expected< std::invoke_result_t< Fn >, std::exception_ptr > try

Monadic try, used to lift a function that throws an exception into one that returns an tl::expected<T, std::exception_ptr>

Parameters:

fn – Function to call

Template Parameters:

Fn – Function type

Returns:

Return value of the function