forked from msdohehrty/dsa555-s16
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortedlist.h
More file actions
80 lines (68 loc) · 1.6 KB
/
sortedlist.h
File metadata and controls
80 lines (68 loc) · 1.6 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//singly linked list
template <typename T>
class SortedList{
struct Node{
T data_;
Node* next_;
Node* prev_;
Node(const T& data, Node* prev=nullptr, Node* next=nullptr){
data_=data;
next_=next;
prev_=prev;
}
};
Node* first_;
Node* last_;
public:
class iterator{
friend class SortedList;
Node* curr_;
SortedList* myList_;
iterator(Node* curr,SortedList* myList){
}
public:
iterator(){
}
T& operator*(){
}
const T& operator*() const{
}
iterator operator++(){
}
iterator operator++(int){
}
iterator operator--(){
}
iterator operator--(int){
}
bool operator==(const iterator& other){
}
bool operator!=(const iterator& other){
}
};
//creates empty linked list
SortedList();
//destructor
~SortedList();
//copy constructor
SortedList(const SortedList& other);
//move constructor
SortedList(const SortedList&& other);
//assignment operator
const SortedList& operator=(const SortedList& other);
//move operator
const SortedList& operator=(const SortedList&& other);
//data into the list
iterator insert(const T& data);
//returns iterator to node containing same value as data
iterator find(const T& data);
//removes the node referred to by it and returns
//the node after the removed node.
iterator erase(iterator it);
//removes all nodes between from and to. This includes
//the node referred to by from but NOT the one referred to by
//to. Function returns iterator to the node referred to by to
iterator erase(iterator from, iterator to);
iterator begin(){return iterator(first_,this);}
iterator end(){return iterator(nullptr,this);}
};