On the description from http://www.cplusplus.com/reference/list/list/erase/ , I get
This effectively reduces the container size by the number of elements removed,
which are destroyed.
Similar description for pop method.
But in my test on VS2012, the item removed is not destroyed. I'm confused about this.
This is my test code. I still can output from the memory erased by std::list, which in my opinion, is WRONG.
#include <stdio.h>
#include <list>
using namespace std;
class test
{
public:
int a;
test() {a = 111;}
};
int main(void)
{
list<test*> l;
test* t = new test;
l.push_back(t);
l.erase(l.begin());
printf("%d\n", t->a);
return 0;
}