Click here to Skip to main content
15,906,625 members

Comments by Member 2246366 (Top 8 by date)

Member 2246366 7-Dec-11 11:52am View    
thanks a lot!! That's the solution. Will take a while to understand it. But I can go on.
Member 2246366 7-Dec-11 11:47am View    
Entered the [] brackets. But that doesn't solve the problem.
And the problem is really that the vector's last item is deleted. I put a breakpoint into the desctructor an erase() calls the destructor of the instance containing i = 4 and pStr = "4". No other destructor is called
Member 2246366 7-Dec-11 11:39am View    
replaced the last lines:
vctc.erase(vctc.begin());
char * pShouldNotHaveBeenDeleted = vctc[3].pStr;
still the same: vctc[3].pStr is somewhere in nirvana
It really has been deleted!

Forgot to mention that the app crashes when it leaves TestVectorErase(). The vector tries to delete it's items and fails to delete the last item
Member 2246366 7-Dec-11 11:06am View    
ok, but to write it clear
I get
vctc[0].pStr is "1"
vctc[1].pStr is "2"
vctc[2].pStr is "3"
vctc[3].pStr is undefined, deleted ...
Member 2246366 7-Dec-11 11:01am View    
isn't this the same:
c(const c & other)
{
pStr = 0;
SetI(other.i);
}