← Back to context

Comment by grandempire

1 day ago

No. This is how sum types are implemented.

And from a runtime perspective it’s going to be a struct with perhaps more padding. You’ll need more details about your specific threat model to explain why that’s bad.

a quick search says that std::variant is the modern replacement to implement your niche feature "sum types"