Re:Emudore: a C64 emulator written from scratch using C++11 ...
by CJefferson on Wednesday April 20, 2016 @04:37AM
(#11533032)
It's a bit horrible and unsafe, but you can use offsetof and some nasty pointer casting to get from a member of a class back to the class. I've done this, and it compiles to extremely efficient code. You can even template a class on the value of offsetof, so you can use the same class as multiple members.
I'm on my phone, so no code examples (sorry). If you want one, reply and I'll write one when I get to a computer!
I'm on my phone, so no code examples (sorry). If you want one, reply and I'll write one when I get to a computer!