-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
45 lines (34 loc) · 1.34 KB
/
stack.h
File metadata and controls
45 lines (34 loc) · 1.34 KB
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
38
39
40
41
42
43
44
45
#ifndef STACK_H_
#define STACK_H_
#include "stack.interface.h"
#include "utils.h"
template <typename T, size_t SIZE>
class Stack : public StackInterface<T, SIZE> {
private:
T stack_[SIZE]; // 항목을 저장할 공간
int top_; // 가장 최근에 입력한 항목을 참조
public:
Stack() : top_{-1} {}
void Push(const T &item) override {
throw utils::todo("스택에 항목을 추가해야 합니다. 스택이 가득 찼을 때 호출하면 에러가 발생해야 합니다.");
}
void Pop() override {
throw utils::todo("스택에서 항목을 제거해야 합니다. 스택이 비어있을 때 호출하면 에러가 발생해야 합니다.");
}
T Peek() const override {
throw utils::todo("가장 최근에 입력한 항목을 반환해야 합니다. 비어있는 스택에서 호출하면 에러가 발생해야 합니다.");
}
bool IsEmpty() const override {
throw utils::todo("스택이 비었는지 여부를 반환해야 합니다.");
}
bool IsFull() const override {
throw utils::todo("스택이 가득 찼는지 여부를 반환해야 합니다.");
}
size_t Size() const override {
throw utils::todo("스택이 가지고 있는 요소의 개수를 반환해야 합니다.");
}
void Clear() override {
throw utils::todo("스택을 비워야 합니다.");
}
};
#endif // STACK_H_