
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 03 October 2008 12:39 pm, vicente.botet wrote:
Yes, I know. I was not wondering about why the X's destructor is not run when deleting b, but why the X's destructor is called when deleting ptr. I
shared_ptr has some magic so it deletes through the same type of pointer that was passed to its constructor, which can eliminate the need for virtual destructors in some cases. Notice how the shared_ptr constructors take the pointer as a template parameter of the constructor, as opposed to just using the template type of the shared_ptr itself. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFI5lwz5vihyNWuA4URAmXBAKDY5j2HiOUUiZLOiftCi/hNbbATGQCfcID4 BUrHpCNhtk1mB3ONgVxYHx4= =HP9H -----END PGP SIGNATURE-----