Queue and Enqueue
Implement a stack class template then simulate an array based queue data structure with
two stack instances.
Implement a queue class template. Remember that queue uses enqueue
and dequeue methods.
Here's a stack:
1 2 3 4 5 6 7 8 9 10 11 12
|
template <class T>
class Stack
{
std::stack data;
public:
bool empty() { return data.empty(); }
int size() { return data.size(); }
const T top() const { return data.top(); }
T top() { return data.top(); }
void push(const T& x) { data.push(x); }
void pop() { data.pop(); }
};
|
Topic archived. No new replies allowed.