ptal/expected

[Monads] Generalize the catch_exception function

viboes opened this issue · 2 comments

boost/expected/algorithms/catch_unexpected.hpp contains a function that can be generalized to all the monad_error that store an exception_ptr, as it is the case of expected<exception_ptr,T> and future<T>.

An alternative is to define this function for the error themselves, but then the user must first get the error and then do the catch_exception.

See #48. Once we have a MonadException concept, we can implement MonadException operations as no member functions of expected<exception_ptr,T>, given that expected<exception_ptr,T> allows to retrieve the stored exception_ptr with the error() function.