This is an attempt to implement an interface similar to std::variant.
https://en.cppreference.com/w/cpp/utility/variant
Some differences are:
- Only single instance of a type
Tis allowed. - No
std::monostatedefault construction support
Doing the above will result in UB.
Every instance of a variant construct a buffer on the heap which is the size of the largest element in the parameter pack. Upon modification, the same buffer is used to placement new and delete in order to destruct the old element and construct the new one.
Next step is to add a std::visit implementation as well.