Subject: Re: [boost] [outcome] How to drop the formal empty state
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2017-05-25 05:42:29
Le 25/05/2017 à 01:06, Niall Douglas via Boost a écrit :
>> 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.
Right and this corresponds to a *moved-from* state. You can not do too
much with this until you know more about T behavior.
I would have preferred to have written a wording that just says that the
post-condition is a *moved-from* state where you can just assign or destroy.
> No need to be complex when simple will do.
This *moved-from* state corresponds exactly to the state we could have
with a uninitialized default constructor. The single things you can do
it to re-assign them or destroy them.
When we move an expected, we don't have any more the value or the error
if the move is not a copy.
I need to state this clearly on the wording of the proposal as it is not
so clear for everyone.