Boost logo

Boost :

Subject: Re: [boost] [outcome] How to drop the formal empty state
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2017-05-25 09:59:05


Le 25/05/2017 à 10:47, Andrzej Krzemienski via Boost a écrit :
> 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?
>
I want to be able to store them in containers and in particular in
std::array. I'd need it to be default constructible.

Vicente


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