3 Apr
2019
3 Apr
'19
1:20 a.m.
Gavin Lambert wrote:
Requiring that variants always possess an empty state dramatically simplifies implementation, including default construction and move assignment. And it avoids the valueless_by_exception kludge by promoting it to an entirely expected possible state of variant. (Thereby increasing the chance that consumers will consider it.)
That's more or less what using `monostate` as the first alternative achieves.