Le 25/05/2017 à 10:47, Andrzej Krzemienski via Boost a écrit :
2017-05-25 1:06 GMT+02:00 Niall Douglas via Boost
: 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
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