#include "stack.h" using namespace std; template bool Stack::push(const NodeType& tmp) { bool status = false; if (this -> length == 0 || this -> info -> getQty() < this -> length) { this -> info -> append(tmp); this -> top = this -> info -> end; } if (this -> top == tmp) { status = true; } return (status); } template bool Stack::push(int value) { bool status = false; if (this -> length == 0 || this -> info -> getQty() < this -> length) { this -> info -> append(value); this -> top = this -> info -> end; } if (this -> top -> getValue() == value) { status = true; } return (status); } template NodeType* Stack::pop() { NodeType* tmp = this -> top; if (this -> top != NULL) { if (this -> top -> getPrev() == NULL) { //tmp = this -> top; this -> top = NULL; } else { //tmp = this -> top; this -> top = this -> top -> getPrev(); this -> top -> setNext(NULL); tmp -> setNext(NULL); tmp -> setPrev(NULL); } } this -> info -> setQty((this -> info -> getQty()) - 1); return (tmp); } template NodeType* Stack::peek() { return (this -> top); }