2017-05-27 1:36 GMT+02:00 Niall Douglas via Boost
As mentioned in another discussion thread, the empty state is also used internally as a micro-optimisation. So it would likely remain internally whatever the decision taken here, as a tool for making the CPU expend identical CPU cycles on both positive and negative branches on state.
Again, if people don't like that behaviour of outcome/result to be equally costly on T or E branches chosen,
What does it mean tha "outcome is equally costly on T or E branches chosen"?
Have a look at https://godbolt.org/g/bVd4D7, specifically the disassembly.
As you'll note, the first possible state (empty) tends to be chosen by the compiler as the most likely. That implies a 20 cycle branch misprediction cost for each of the valued or errored states. So they are equally costly, which is intentional.
Would you not rather manually "predict" for the valued state?