Gottlob Frege wrote:
I'm happy with std::variant. It makes some trade-offs, but I can live with them. But once someone tries to make a variant with less trade-offs, it seems to me you should just go all the way - no trade-offs. I can and will live with trade-offs, but who wouldn't like no trade-offs?
Basically, I was surprised that there was something between std::variant and no-compromises-variant. It seems you want to explore that area - _different_ trade-offs, or just _less_ trade-offs. But you are approaching zero, I think you should just do zero. I could easily be wrong.
All right. My current iteration is "zero" unless you specifically opt into nonzero by placing the special type "valueless" as a first alternative. For the example use cases in my previous message,
variant
v1, v2; X x; v1 = v2; // do you expect strong guarantee here? v1 = std::move(v2); // here? v1 = x; // here? v1 = std::move(x); // here? v1.emplace<X>(); // here?
where X is not the type 'valueless', this would translate to: v1 = v2; // as strong as X::op=(X const&) v1 = std::move(v2); // as strong as X::op=(X&&) v1 = x; // as strong as X::op=(X const&) v1 = std::move(x); // as strong as X::op=(X&&) v1.emplace<X>(); // always strong