ptal / expected

What did you expect?
113 stars 18 forks source link

[Monads] Generalize the has_exception algorithm #13

Closed viboes closed 10 years ago

viboes commented 10 years ago

boost/expected/algorithms/has_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 has_exception.

viboes commented 10 years ago

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.

viboes commented 10 years ago

https://github.com/ptal/Boost.Expected/commit/8a7abc6417bc3c7be6b5afa339c1c8f6216ea3c3 https://github.com/ptal/Boost.Expected/commit/750f699787954349eb572ab85638b0ace642a1bb