On 6/1/17 10:24 AM, Vicente J. Botet Escriba via Boost wrote:
The problem is that we don't have a never-empty variant in Boost (we have Boost.Variant, but it uses double buffer IIRC). Vicente
Right - so isn't variant the place to "fix" it? if outcome, expected,
optional ... need a never-empty guarantee, should variant (std, boost,
whatever) have that guarantee as well? Shouldn't these discussions take
place in the context of variant?
Now if the "best" implementation of variant isn't the "best" one for one
of it's derivatives - then I would ask why not? How are they different.
Of course this can windup as variant having a policy. I haven't seen
this but I would be very surprised if it hasn't come up. In any case it
seems that it would be much more efficient for these types to derive
from variant then repeat implementations - each with a little different
sauce. Not only more efficient as in reducing code. But more efficient
in consumption of my limited brain power:
OK I understand variant, never empty or not, etc...
template<class T>
using outcome = std::variant