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

Function compute_answer

example/exception_to_result.cpp:34–44  ·  view source on GitHub ↗

Call compute_answer_throws, switch to result for error handling.

Source from the content-addressed store, hash-verified

32
33// Call compute_answer_throws, switch to result<int> for error handling.
34leaf::result<int> compute_answer() noexcept
35{
36 // Convert exceptions of types error_a and error_b to be communicated by
37 // leaf::result. Any other exception will be communicated as a
38 // std::exception_ptr.
39 return leaf::exception_to_result<error_a, error_b>(
40 []
41 {
42 return compute_answer_throws();
43 } );
44}
45
46
47// Print the answer if the call to compute_answer is successful.

Callers 1

print_answerFunction · 0.70

Calls 1

compute_answer_throwsFunction · 0.85

Tested by

no test coverage detected