Andrzej Krzemienski wrote:
Some other thoughts:
When valueless is required as the first type, it also implies that the default constructor of variant puts it into valueless state, which some might find useful, but others inferior to std::variant. Would it be possible to also assign a special meaning to putting `valueless` at the end, which would assign semantics of std::variant?
`valueless` is proving to be a nuisance. I have for instance expected
Maybe the choice how you want to implement the assignment should be explicitly controlled by the users (in form of a policy)? You could still provide the defaults based on properties of the types, but it looks to me sometimes people might want to override the defaults. For instance, we have seen examples where I want strong guarantee on assignment even when T does not offer one.
You use emplace then, or move assignment. Or swap, although I need to double-check whether it does what it needs to do in all the various cases.