#include "Stack.h"

typedef list<string>::iterator Iter;

typedef list<string>::const_iterator CIter;


Stack::Stack() {

list<string>();

}

void Stack::pop() {

assert(!empty());

Iter pos = end();

    --pos;

erase(pos);

}

void Stack::push(string val) {

push_back(val);

}

bool Stack::empty() const {

return list<string>::empty();

}

string Stack::top() {

Iter pos = end();

    --pos;

    return *pos;

}

---------------------------------stack is a list========

#include "Stack.h"
typedef list<string>::iterator Iter;
typedef list<string>::const_iterator CIter;

Stack::Stack() {
pStack list<string>();
}
Stack::~Stack() {
delete pStackData;
}
void Stack::pop() {
assert(!empty());
Iter pos = pStackData->end();
    --pos;
    pStackData->erase(pos);
}
void Stack::push(string val) {
pStackData->push_back(val);
}
bool Stack::empty() const {
return pStackData->empty();
}
string Stack::top() {
Iter pos = pStackData->end();
    --pos;
    return *pos;
}

======================stack Has a list