- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDequeStack.h
More file actions
Latest commit
37 lines (31 loc) · 554 Bytes
/
Copy pathDequeStack.h
File metadata and controls
37 lines (31 loc) · 554 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef STACK_DEQUESTACK_H
#defineSTACK_DEQUESTACK_H
#include<deque>
#include"Stack.h"
template <classT>
classDequeStack: publicStack<T> {
public:
voidpush (const T& val);
T pop ();
boolempty();
private:
std::deque<T> stack;
};
template<classT>
void
DequeStack<T>::push(const T &val) {
stack.push_back(val);
}
template<classT>
T
DequeStack<T>::pop() {
T v = stack.back();
stack.pop_back();
return v;
}
template<classT>
bool
DequeStack<T>::empty() {
return stack.empty();
}
#endif//STACK_DEQUESTACK_H