
On 10/27/05, Victor A. Wagner Jr. <vawjr@rudbek.com> wrote:
indeed, but there is no dynamic type vs static type in the example.
If you have a virtual_vector<person>* which points to an instance of people, and you call delete with that pointer as an operand, you have undefined behavior unless virtual_vector<person> has a virtual destructor since virtual_vector<person> is the static type and people is the dynamic type. Whether the base or derived type has a trivial or non-trivial destructor doesn't change that. The behavior is always undefined. If you were talking about just deleting a people pointer pointing to a people object, of course there would be no need for a virtual destructor, though if that's all that you're talking about, I still don't see why you are differentiating between trivial and nontrivial destructors. Whether or not the destructor is trivial or non-trivial still makes no difference, just like in the previous example. On 10/27/05, Victor A. Wagner Jr. <vawjr@rudbek.com> wrote:
I didn't suggest them, I'm arguing that for the example given they aren't necessary
This was targeted at the original poster who asked if there is interest. It wasn't intended for you. -- -Matt Calabrese