Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualRadikalizm

Posted 08 December 2012 - 02:20 PM

Still, doesn't the vector destructor call the object's destructor upon deletion?


A vector does call a destructor for an object it holds when that object is erased, but this vector is storing pointer objects, not Entity objects.
So basically the vector is calling a destructor for the pointer object (which is perfectly legal), but that doesn't mean the destructor for the object the pointer is pointing to gets called or that the memory consumed by the object the pointer is pointing to gets released.

#1Radikalizm

Posted 08 December 2012 - 02:20 PM

Still, doesn't the vector destructor call the object's destructor upon deletion?


A vector does call a destructor for an object it holds when that object is erased, but this vector is storing pointer objects, not Entity objects.
So basically the vector is calling a destructor for the pointer object (which is perfectly legal), but that doesn't mean the destructor for the object the pointer is pointing to gets called.

PARTNERS