-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
44 lines (36 loc) · 829 Bytes
/
Copy pathstack.h
File metadata and controls
44 lines (36 loc) · 829 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
38
39
40
41
42
43
44
#ifndef STACK_H
#define STACK_H
#include <exception>
#include <iostream>
template <typename T> class Stack {
public:
Stack() = default;
Stack(const Stack<T> &stack);
~Stack();
void push(const T &item);
T pop();
bool is_empty() const {
return head == nullptr;
}
Stack<T> &operator=(const Stack<T> &stack);
private:
class Node {
public:
T item {};
Node *next {};
Node(const T &item) : item { item }, next { nullptr } {};
};
// struct Node {
// T item {};
// Node *next {};
// Node(const T &item) : item { item }, next { nullptr } {
// }
// Node(const Node &node) {
// item = node.item;
// next = node.next;
// }
// };
Node *head {};
};
#include "stack.hpp"
#endif