|
-
June 7th, 2011, 10:50 AM
#3
Re: delete element from vector
Because you don't have a vector of PRJNODE; you have a vector of PRJNODE*. The destructor of a pointer is trivially empty.
If you had a vector of PRJNODE, then erasing an element would call its destructor (and probably invoke copy or move semantics on other elements in the vector as they are shuffled over). But you have instead chosen to use a vector of pointers, which are a primitive type.
The fact that the pointer points to a particular type is something you know. It is not something the vector knows, and if you think about it for a minute, you'd realize how terrible an idea it would be for a vector to go invoking "delete" on any pointer it happened to contain.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|