I've created a list of stacks.
using namespace std;
list<stack<int>> stacks;
stack<int> *st = new stack<int>();      //LINE0
stacks.push_back(*st);
st->push(10);   
stack<int> *last = &stacks.back();
stacks.pop_back();    //LINE1
delete last;          //LINE2
LINE2 will cause an unhandled exception. Will LINE1 automatically deallocate the memory allocated at LINE0? Is LINE2 not necessary?
 
     
    