Boost logo

Boost :

Subject: Re: [boost] Boost.Outcome review - First questions
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-24 01:06:01


Gavin Lambert wrote:
> Fairly certain he was referring to the suggestion earlier in the same
> message, ie:
>
> On 24/05/2017 03:19, Niall Douglas wrote:
> > Back at the beginning when designing Outcome, one of my design ideas was
> > a variety which called std::terminate on destruction if an error had
> > never been retrieved. So, the idea behind this family of Outcomes was
> > that they were "single shot", .error() and .value() could be called
> > exactly once after which the outcome became empty. On destruction, if an
> > error had never been retrieved, it was fatal exit time.

Ah, that. Thanks Gavin.

I wouldn't go as far as calling terminate(), but one could log. But for this
to work, the outcome must be noncopyable (move-only). Otherwise if you make
a few copies, none of it could know whether you inspected the error of some
of the other copies or not.

This doesn't require an empty state though, just a bit that is set (or maybe
cleared) when error() is called.


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