Let me just recall her the suggestion from Peter made in the other thread. Mybe have two types: `expected
` does not have the empty state or default constructor -- it is used as function's return type `prepare_expected ` is either T or E or Empty -- you use it inside function to build expected : ``` expected
f() { prepare_expected ans; // populate (or not) ans return ans; // in this conversion you can do all sorts of checks } ``` When it comes to converting from `prepare_expected
` to `expected `, you have plenty of choices: require manual conversion, narrow-contract to be checked, a defensive if and throw... I am just not sure if performance can be negatively impacted with this.
I originally considered this design for Outcome's API. I ended up rejecting it because it's superfluous if you have correctly designed your expected/outcome/whatever in the first place. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/