Refactors mson::Element to use variant instead of a structure containing members for every type that could be stored in it. There are at least three more opportunities for improvement like this in MSON.h to be refactored in the future, matching this PR.
Principle
Let's say there is structure Content that can hold either Foo or Bar (but never both, i.e. a Σ-type). Currently, we use something like:
Refactors mson::Element to use
variant
instead of a structure containing members for every type that could be stored in it. There are at least three more opportunities for improvement like this inMSON.h
to be refactored in the future, matching this PR.Principle
Let's say there is structure
Content
that can hold eitherFoo
orBar
(but never both, i.e. a Σ-type). Currently, we use something like:Much better, we can write:
Benefits