On Tue, Jan 22, 2019 at 2:34 PM Emil Dotchevski via Boost
Using try_ will now handle result<T> errors as well, see https://github.com/zajo/leaf/blob/feature/error_code/test/try_exception_and_... .
With this, in your example instead of handle_all you can just use try_:
leaf::try_( [i]() -> leaf::result<int> { LEAF_AUTO(r, f2(i)); (void) r; return 0; }, //handlers...
Yes, the output of the attached program shows closer to what I had in mind, if compiled with g++ 7 or 8, release mode. It has two problems though: - in release mode the program crashes if I try to print 'verbose_diagnostic_info' <snip> f2(7) Segmentation fault (core dumped) - in debug mode it crashes right at the beginning f2(0) leaf_test: /mnt/d/Sorin/Work/C++/cpp-playground/tmp/include/boost/leaf/detail/teleport.hpp:195: const std::exception* boost::leaf::error_info::exception() const: Assertion `has_exception()' failed. Aborted (core dumped) Thanks, Sorin