Re: [C++] Vectors & Dynamic allocation

From: Anand Hariharan (desh_bakth_at_yahoo.com)
Date: 04/30/04


Date: 29 Apr 2004 16:59:30 -0700

Robert W Hand <rwhand@NOSPAMoperamail.com> wrote in message news:<iovt80phf4fkdq2dtikc0e8e82abju544n@4ax.com>...

> I agree that complexity requirements for
> std::vector::erase clearly prohibit deallocation of the elements.
>

Am unsure what the complexity requirements might have to do with the
deallocation of elements.

AFAICS, getting vector's erase to check if the elements need
deallocation etc mimics Garbage collection - a price a developer might
not be willing to pay. However, even if this were to be included, its
complexity would still be O(n), isn't it?

- Anand

PS: If my above post proclaims that I am clueless about the
standard's complexity requirements, so be it! :-)