Boost logo

Boost :

Subject: Re: [boost] [outcome] How to drop the formal empty state
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-26 14:23:55


Niall Douglas wrote:

> But after I built up some experience, now I tend to write this instead:
>
> result<Foo> something()
> {
> result<Foo> ret(Foo());
> Foo &foo = ret.value();
> ... build foo ...
> return ret;
> }

This takes us back to "what if due to a logic error the code that should
build `foo` doesn't?"

And since you've constructed `ret` to non-empty, the point of empty is,
again, lost.


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