Hi,
Can somebody explain the following behaviour? Even after deleting the
member of list, I am not getting segmentation fault at last line (as
expected). Rather foo () output is what comes out.
#include<list>
list<A*> l;
int main ()
{
A* a = new A ();
cout << a->foo () << endl; // Prints 0 which is OK
l.push_back (a);
for (list<A*>::iterator it = l.begin (); it != l.end (); it++) {
delete (*it);
}
cout << a->foo () << endl; // Should give Segmentation Fault
but its not !!!! Prints 0 which is not OK.
}
Regards,
Aseem.
--
The end is always good. If it's not good, it's not the end.