#include "stdafx.h"
#include <list>
using namespace std;
struct St
{
int m;
int l;
};
int _tmain(int argc, _TCHAR* argv[])
{
St* temp = new St;
temp->l = 5;
temp->m = 10;
list <St*> list1;
list <St*>::iterator list1_it;
list <St*> list2;
list1.push_back(temp);
list2.push_back(temp);
list1_it = list1.begin();
delete (*list1_it);
(*list1_it) = NULL;
// break here
// list1 has a NULL in
// list2 has random stuff though , but theey still poining at same thing , how do i make it NULL , with out directly accessing list2 ?
return 0;
}
just by deleting from list1 and making that point to NULL , i want list2 to be NULL for the same entry