
Vicente J. Botet Escriba wrote:
I see that you want to be able to store error_code or exception_ptr. Wouldn't the interface of expected<T, variant<error_code, exception_ptr>> be enough?
future<T> already adds the ability to store exception_ptr. There is no need to store another exception_ptr in the value. Niall's type is exactly equivalent to future<expected<T, error_code>>, as I already said (twice).
I proposed to the C++ standard a function future<T>::next (bind) that takes a continuation having T as parameter (future<R>(T)), and and future<T>::catch_error that takes a as parameter a continuation that takes an errror as parameter. The proposal was not accepted.
future<T>::next( [](T){...} ) is actually pretty useful, catch_error() much less so. You should have proposed just the former. (Sean Parent's future implementation's ::then has ::next's semantics IIRC.)