Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
abbeyj
· 4y ago · 0 comments
If the union is untagged, how can it be determined (at runtime) that you've accessed the wrong field?
Comments
[–]
Spex_guy
4y ago
The compiler adds a tag in debug modes, but not in release modes.
[–]
a_t48
4y ago
Neat, that's somewhere in between a `union` and a `std::variant`. You could build your own, but it's cool that it's a first class member of the language.