#ifndef _STACK_H_ #define _STACK_H_ #include "StackNode.h" typedef void (*payload_free_fn)(void*); class Stack { public: Stack(payload_free_fn pfree); ~Stack(); void push(void * const elem); bool pop(void ** const out); bool peek(void ** const out) const; bool isEmpty() const; private: /* head_ must be a const StackNode* because it stores the result of StackNode::getNext(), * which returns a const StackNode* */ const StackNode *head_; payload_free_fn pfree_; Stack(const Stack &s); Stack &operator=(const Stack &rhs); }; #endif // _STACK_H_