Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If the union is untagged, how can it be determined (at runtime) that you've accessed the wrong field?


The compiler adds a tag in debug modes, but not in release modes.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: