Boost logo

Boost :

Subject: Re: [boost] [outcome] How to drop the formal empty state
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-05-25 08:47:34


2017-05-25 1:06 GMT+02:00 Niall Douglas via Boost <boost_at_[hidden]>:

> > Let me just clarify the nomenclature here. I understand that the only
> thing
> > you *need* to have is the *moved-form* state. There is no strong need to
> > provide a default constructor. Sure if you have a moved-from state, you
> > might as well use it in default constructor, but it is not the only
> option.
> > You could allow the moved-from state only as the result of a move.
>
> You don't need a moved-from state. If expected<T, E> is moved from and
> it had state T, it retains a state T, the value is whatever type T's
> move constructor left it in.
>
> No need to be complex when simple will do.
>

You are right. Maybe we do not need the default constructor at all, then?
If the purpose of outcome<> and friends is to be just returned from
functions mabe only movable and non-default constructlble interface is
sufficient. But if you later want to store them in containers this will not
be enough. Maybe the scope should be fixed: what usages do we want to
handle?

Regards,
&rzej;


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