2 #ifdef USE_INITIALIZER_LIST
3 #include "InitializerList.h"
59 inline operator bool() {
return is_eof; }
68 for (
int j = 0; j < offset; j++) {
69 if (tmp->
next ==
nullptr) {
74 }
else if (offset < 0) {
75 for (
int j = 0; j < -offset; j++) {
76 if (tmp->
prior ==
nullptr) {
100 for (
int i = 0; i < N; ++i)
push_back(a[i]);
105 #ifdef USE_INITIALIZER_LIST
107 List(std::initializer_list<T> iniList) {
109 for (
auto &obj : iniList)
push_back(obj);
130 if (node ==
nullptr)
return false;
136 node->
prior = old_last_prior;
137 old_last_prior->
next = node;
147 if (node ==
nullptr)
return false;
153 node->
next = old_begin_next;
154 old_begin_next->
prior = node;
164 if (node ==
nullptr)
return false;
172 current_node->
prior = node;
174 node->
next = current_node;
198 data = p_delete->
data;
201 p_prior->
next = p_next;
202 p_next->
prior = p_prior;
219 data = p_delete->
data;
222 p_prior->
next = p_next;
223 p_next->
prior = p_prior;
243 p_prior->
next = p_next;
244 p_next->
prior = p_prior;
284 for (
int j = 0; j < index; j++) {
Memory allocateator which uses malloc.
Definition: Allocator.h:21
virtual void * allocate(size_t size)
Allocates memory.
Definition: Allocator.h:61
virtual void free(void *memory)
frees memory
Definition: Allocator.h:77
bool operator==(Iterator it)
Definition: List.h:54
bool is_eof
Definition: List.h:63
Iterator operator++()
Definition: List.h:30
Iterator(Node *node)
Definition: List.h:29
Iterator operator-(int offset)
Definition: List.h:51
Iterator getIteratorAtOffset(int offset)
Definition: List.h:65
Iterator operator+(int offset)
Definition: List.h:48
T * operator->()
Definition: List.h:57
Node * get_node()
Definition: List.h:58
Node * node
Definition: List.h:62
bool operator!=(Iterator it)
Definition: List.h:55
Iterator operator--()
Definition: List.h:39
Iterator operator++(int)
Definition: List.h:38
T & operator*()
Definition: List.h:56
Iterator operator--(int)
Definition: List.h:47
Double linked list.
Definition: List.h:19
Iterator rend()
Definition: List.h:267
bool pop_back()
Definition: List.h:186
Iterator rbegin()
Definition: List.h:262
bool swap(List< T > &ref)
Definition: List.h:112
Node last
Definition: List.h:301
Node first
Definition: List.h:299
bool push_front(T data)
Definition: List.h:145
bool pop_back(T &data)
Definition: List.h:212
~List()
Definition: List.h:103
List(const T(&a)[N], Allocator &allocator=DefaultAllocator)
Constructor using array.
Definition: List.h:97
Iterator end()
Definition: List.h:257
bool clear()
Definition: List.h:276
size_t size()
Definition: List.h:272
Node * firstDataNode()
Definition: List.h:329
bool push_back(T data)
Definition: List.h:128
Node * createNode()
Definition: List.h:306
T & back()
Provides the last element.
Definition: List.h:296
void link()
Definition: List.h:323
size_t record_count
Definition: List.h:303
void deleteNode(Node *p_delete)
Definition: List.h:315
List(List &ref)=default
copy constructor
List(Allocator &allocator=DefaultAllocator)
Default constructor.
Definition: List.h:88
T & operator[](int index)
Definition: List.h:282
bool insert(Iterator it, const T &data)
Definition: List.h:162
Node * lastDataNode()
Definition: List.h:328
bool empty()
Definition: List.h:274
bool erase(Iterator it)
Definition: List.h:233
bool pop_front()
Definition: List.h:181
Allocator * p_allocator
Definition: List.h:304
bool pop_front(T &data)
Definition: List.h:191
void validate()
Definition: List.h:331
Iterator begin()
Definition: List.h:252
void setAllocator(Allocator &allocator)
Definition: List.h:293
Definition: Allocator.h:6
Node * prior
Definition: List.h:23
Node * next
Definition: List.h:22
T data
Definition: List.h:24