3 ms·
Seems like this could be handled with a wrapper type with runtime checks during debug? Like make any pointer to the per frame allocation be a TempPointer or so
by foota 7y ago
Seems like this could be handled with a wrapper type with runtime checks during debug?
Like make any pointer to the per frame allocation be a TempPointer or something and then assert they're all gone with a static count variable of them? Then you just have to be cautious whenever you pass a reference to one or convert to a raw pointer.
I don't think this would be too awful for performance in debug builds.
- monocasa 7y agoYeah, or a generation system where the pointer holds a frame count too that's asserted on deref. The point though is that it's a step back still from shared_ptr/unique_ptr by becoming a runtime check instead of compile time.