MCPcopy Create free account
hub / github.com/boostorg/leaf / try_handle_all

Function try_handle_all

include/boost/leaf/handle_errors.hpp:610–628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608
609template <class TryBlock, class... H>
610inline
611typename std::decay<decltype(std::declval<TryBlock>()().value())>::type
612try_handle_all( TryBlock && try_block, H && ... h )
613{
614 static_assert(is_result_type<decltype(std::declval<TryBlock>()())>::value, "The return type of the try_block passed to try_handle_all must be registered with leaf::is_result_type");
615 context_type_from_handlers<H...> ctx;
616 auto active_context = activate_context(ctx);
617 if( auto r = detail::try_catch_(ctx, std::forward<TryBlock>(try_block), std::forward<H>(h)...) )
618 return std::move(r).value();
619 else
620 {
621 BOOST_LEAF_ASSERT(ctx.is_active());
622 detail::unload_result(&r);
623 error_id id(r.error());
624 ctx.deactivate();
625 using R = typename std::decay<decltype(std::declval<TryBlock>()().value())>::type;
626 return ctx.template handle_error<R>(std::move(id), std::forward<H>(h)...);
627 }
628}
629
630template <class TryBlock, class... H>
631BOOST_LEAF_ATTRIBUTE_NODISCARD inline

Callers 15

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
test_resultFunction · 0.85
testFunction · 0.85

Calls 5

activate_contextFunction · 0.85
try_catch_Function · 0.85
unload_resultFunction · 0.85
valueMethod · 0.45
deactivateMethod · 0.45

Tested by 15

mainFunction · 0.68
mainFunction · 0.68
test_resultFunction · 0.68
testFunction · 0.68
test_voidFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
testFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68