Join me for an October scary story as we try to find the identity of the scariest C++ cast.
The original inspiration for implementing public_cast came from here. I wrote my own version which is more modern and (IMHO) easier to understand, but I take no credit for the ingenuity (and devilishness) of the basic implementation technique.
https://github.com/libretro/bneslibr...
After uploading the video, I realized you could use a trait type, something like public_cast_traits, and specialize it with CxSecret to "store" the member pointer type (int C::*) once, and then just look it up inside public_cast, so you don't have to repeat it at every "call site." That's one possible solution for the part where I said to let me know if you have any ideas.
implicit_cast can be found in boost: https://www.boost.org/doc/libs/1_79_0...
Other stuff:
evil floating point bit level hacking: https://en.wikipedia.org/wiki/Fast_in...
Strict Aliasing: https://gist.github.com/shafik/848ae2...
I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.
https://www.manim.community/
https://www.blender.org/
https://www.audacityteam.org/