11 Jul
2017
11 Jul
'17
11:53 a.m.
Niall Douglas wrote:
Indeed, outcome<> actually reuses 90% of result<>'s implementation by supplying an outcome-ish no-value policy, so it saves me a ton of maintenance and copy and paste as well.
I would make outcome<> reuse 100% of result<>'s implementation, by stealing another page from your playbook: class extended_error_code { std::error_code e_; std::exception_ptr x_; }; template<class T> using outcome = result<T, extended_error_code>; I would also use union { T t; E e; } in result instead of a struct. :-)