Back in 2021, I wrote about unions in my professional capacity (disclaimer: this is my personal space and my employer does not necessarily endorse what I say here) on the PyTorch Dev Discussions forum. Stick with (or skip) the C++ 101 “What is a union?” section and you’ll be rewarded with the advanced material in the second half. Please enjoy!
I’ve written several other articles on that forum as well, if you’re interested.