Subject: [boost] [outcome] How to drop the formal empty state
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-24 19:43:30
There has been a fair bit of review feedback that people don't like the
formal empty state in outcome<T> and result<T>. I still think this
opinion daft, just because it's there doesn't mean you have to use it,
but here are some options:
1. Like Expected, we could require the E types to provide a nothrow move
constructor. This would allow us to guarantee no empty state, not ever.
Default constructing an outcome<T> or result<T> would set a default
constructed T state, just like Expected.
The only remaining difference now between result<T> and expected<T>
would be the wide vs narrow observer functions. outcome<T> still can
also carry a std::exception_ptr.
2. We could do the above, but default constructor constructs to some
constexpr undefined state that is not state T nor E.
3. We could only provide a guarantee of no empty state if the E types
provide nothrow move construction, but if they do not we fall back to an
empty state arising if throws occur during assignment.
4. The option for an empty state becomes a template parameter defaulted
to false i.e. disabled. This can be combined with any of the above.
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/