
7 Oct
2011
7 Oct
'11
8:46 p.m.
El 07/10/2011 2:15, Brian escribió:
Is there anyway I can delete the constructed object using b? I tried segment.destroy_ptr(b.get()) and segment.deallocate(b.get()) but I get assertion failures. Obviously segment.destroy_ptr(a.get()) would work but I'd like to be able to do it with a pointer to the parent class. Also casting won't work because I won't know if it's a dog or a cat when I delete it.
No, you need virtual destructors for that, and classes with virtual operations are not safely placeable in shared memory. Best, Ion