Sorry, debugger show the content of pvec right all the time; this is the complete code:
Qt Code:
  1. vector<int*>* pvec = new vector<int*>();
  2. {
  3. int ten=10, twenty=20, thirty=30;
  4. int *pten = &ten;
  5. //int* pten = new int(ten);
  6. int* ptwenty = &twenty;
  7. int* pthirty = &thirty;
  8. pvec->push_back(pten);
  9. pvec->push_back(ptwenty);
  10. pvec->push_back(pthirty);
  11. }
  12.  
  13. *(*pvec)[0] = 99; //no problems
  14. int q = 1000;
  15. (*pvec)[0] = &q;
  16. vector<int*>::iterator it;
  17. for(it=pvec->begin(); it != pvec->end(); ++it) {
  18. cout << "*it " << *(*it) << " ";
  19. }
  20. //delete (*pvec)[0];
  21. delete pvec;
To copy to clipboard, switch view to plain text mode 
Obviously ten will be destroyed out the scope but out of it (*pvec)[0] still contains the number 10 (and debugger show that this pointer doens't change....)
I'm sorry but could you explain me more? thanks