2#ifdef USE_INITIALIZER_LIST
3#include "InitializerList.h"
61 inline operator bool() {
return is_eof; }
70 for (
int j = 0; j < offset; j++) {
71 if (tmp->
next ==
nullptr) {
76 }
else if (offset < 0) {
77 for (
int j = 0; j < -offset; j++) {
78 if (tmp->
prior ==
nullptr) {
102 for (
int i = 0; i < N; ++i)
push_back(a[i]);
107#ifdef USE_INITIALIZER_LIST
109 List(std::initializer_list<T> iniList) {
111 for (
auto &obj : iniList)
push_back(obj);
132 if (node ==
nullptr)
return false;
138 node->
prior = old_last_prior;
139 old_last_prior->
next = node;
149 if (node ==
nullptr)
return false;
155 node->
next = old_begin_next;
156 old_begin_next->
prior = node;
166 if (node ==
nullptr)
return false;
174 current_node->
prior = node;
176 node->
next = current_node;
200 data = p_delete->
data;
203 p_prior->
next = p_next;
204 p_next->
prior = p_prior;
221 data = p_delete->
data;
224 p_prior->
next = p_next;
225 p_next->
prior = p_prior;
245 p_prior->
next = p_next;
246 p_next->
prior = p_prior;
286 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
List Iterator.
Definition: List.h:29
bool operator==(Iterator it)
Definition: List.h:56
bool is_eof
Definition: List.h:65
Iterator operator++()
Definition: List.h:32
Iterator(Node *node)
Definition: List.h:31
Iterator operator-(int offset)
Definition: List.h:53
Iterator getIteratorAtOffset(int offset)
Definition: List.h:67
Iterator operator+(int offset)
Definition: List.h:50
Node * node
Definition: List.h:64
Node * get_node()
Definition: List.h:60
bool operator!=(Iterator it)
Definition: List.h:57
Iterator operator--()
Definition: List.h:41
Iterator operator++(int)
Definition: List.h:40
T * operator->()
Definition: List.h:59
T & operator*()
Definition: List.h:58
Iterator operator--(int)
Definition: List.h:49
Double linked list.
Definition: List.h:19
T & back()
Provides the last element.
Definition: List.h:298
Iterator rend()
Definition: List.h:269
bool pop_back()
Definition: List.h:188
Iterator rbegin()
Definition: List.h:264
bool swap(List< T > &ref)
Definition: List.h:114
Node last
Definition: List.h:303
Node * createNode()
Definition: List.h:308
Node first
Definition: List.h:301
bool push_front(T data)
Definition: List.h:147
bool pop_back(T &data)
Definition: List.h:214
~List()
Definition: List.h:105
Node * firstDataNode()
Definition: List.h:331
List(const T(&a)[N], Allocator &allocator=DefaultAllocator)
Constructor using array.
Definition: List.h:99
Iterator end()
Definition: List.h:259
bool clear()
Definition: List.h:278
size_t size()
Definition: List.h:274
bool push_back(T data)
Definition: List.h:130
void link()
Definition: List.h:325
size_t record_count
Definition: List.h:305
void deleteNode(Node *p_delete)
Definition: List.h:317
List(List &ref)=default
copy constructor
List(Allocator &allocator=DefaultAllocator)
Default constructor.
Definition: List.h:90
bool insert(Iterator it, const T &data)
Definition: List.h:164
Node * lastDataNode()
Definition: List.h:330
bool empty()
Definition: List.h:276
bool erase(Iterator it)
Definition: List.h:235
T & operator[](int index)
Definition: List.h:284
bool pop_front()
Definition: List.h:183
Allocator * p_allocator
Definition: List.h:306
bool pop_front(T &data)
Definition: List.h:193
void validate()
Definition: List.h:333
Iterator begin()
Definition: List.h:254
void setAllocator(Allocator &allocator)
Definition: List.h:295
Definition: Allocator.h:6
List Node.
Definition: List.h:22
Node * prior
Definition: List.h:24
Node * next
Definition: List.h:23
T data
Definition: List.h:25