Boost logo

Boost :

Subject: Re: [boost] Outcome v2 (was: Re: Error handling libraries and proposals)
From: Peter Dimov (lists_at_[hidden])
Date: 2017-07-11 11:53:48


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. :-)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk