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.
github.com/lib...
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: www.boost.org/...
Other stuff:
evil floating point bit level hacking: en.wikipedia.o...
Strict Aliasing: gist.github.co...
I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.
www.manim.comm...
www.blender.org/
www.audacityte...
Негізгі бет Cursed C++ Casts
Пікірлер: 468