18template <
class T,
class Alloc = DLNA_ALLOCATOR<T>>
59 assert(
node !=
nullptr);
63 assert(
node !=
nullptr);
67 inline operator bool() {
return is_eof; }
76 for (
int j = 0; j < offset; j++) {
77 if (tmp->
next ==
nullptr) {
82 }
else if (offset < 0) {
83 for (
int j = 0; j < -offset; j++) {
84 if (tmp->
prior ==
nullptr) {
105 for (
int i = 0; i < N; ++i)
push_back(a[i]);
130 if (node ==
nullptr)
return false;
136 node->
prior = old_last_prior;
137 old_last_prior->
next = node;
148 if (node ==
nullptr)
return false;
149 node->
data = std::move(data);
153 node->
prior = old_last_prior;
154 old_last_prior->
next = node;
165 if (node ==
nullptr)
return false;
171 node->
next = old_begin_next;
172 old_begin_next->
prior = node;
183 if (node ==
nullptr)
return false;
184 node->
data = std::move(data);
189 node->
next = old_begin_next;
190 old_begin_next->
prior = node;
200 if (node ==
nullptr)
return false;
208 current_node->
prior = node;
210 node->
next = current_node;
220 if (node ==
nullptr)
return false;
221 node->
data = std::move(data);
228 current_node->
prior = node;
230 node->
next = current_node;
254 data = p_delete->
data;
257 p_prior->
next = p_next;
258 p_next->
prior = p_prior;
271 if (p_delete ==
nullptr)
return false;
276 data = p_delete->
data;
279 p_prior->
next = p_next;
280 p_next->
prior = p_prior;
300 p_prior->
next = p_next;
301 p_next->
prior = p_prior;
341 for (
int j = 0; j < index; j++) {
342 if (n == &
last || n ==
nullptr) {
343 assert(
false &&
"List index out of bounds");
348 if (n == &
last || n ==
nullptr) {
349 assert(
false &&
"List index out of bounds");
366 using NodeAlloc =
typename std::allocator_traits<Alloc>::template rebind_alloc<Node>;
376 if (!p_delete)
return;
List Iterator.
Definition: List.h:29
Iterator operator-(int offset)
Definition: List.h:53
Node * node
Definition: List.h:70
Node * get_node()
Definition: List.h:66
T & operator*()
Definition: List.h:58
T * operator->()
Definition: List.h:62
Iterator operator++(int)
Definition: List.h:40
Iterator(Node *node)
Definition: List.h:31
Iterator operator--()
Definition: List.h:41
Iterator operator++()
Definition: List.h:32
bool operator==(Iterator it)
Definition: List.h:56
Iterator operator+(int offset)
Definition: List.h:50
bool operator!=(Iterator it)
Definition: List.h:57
bool is_eof
Definition: List.h:71
Iterator operator--(int)
Definition: List.h:49
Iterator getIteratorAtOffset(int offset)
Definition: List.h:73
Double linked list.
Definition: List.h:19
size_t record_count
Definition: List.h:365
bool pop_front(T &data)
Definition: List.h:247
bool swap(List< T > &ref)
Definition: List.h:110
void deleteNode(Node *p_delete)
Definition: List.h:375
Iterator begin()
Definition: List.h:309
List(const T(&a)[N])
Constructor using array.
Definition: List.h:103
~List()
Definition: List.h:108
bool pop_back(T &data)
Definition: List.h:268
bool push_front(T &data)
Definition: List.h:163
Node first
Definition: List.h:361
T & back()
Provides the last element.
Definition: List.h:358
bool empty()
Definition: List.h:331
bool push_back(T &data)
Definition: List.h:128
bool push_front(T &&data)
Definition: List.h:181
List(List &ref)=default
copy constructor
Node * lastDataNode()
Definition: List.h:386
Node last
Definition: List.h:363
bool insert(Iterator it, T &data)
Definition: List.h:198
void link()
Definition: List.h:381
Iterator end()
Definition: List.h:314
List(const Alloc &alloc)
Definition: List.h:97
List()
Default constructor.
Definition: List.h:96
bool insert(Iterator it, T &&data)
Definition: List.h:218
NodeAlloc node_alloc_
Definition: List.h:367
bool pop_front()
Definition: List.h:237
size_t size()
Definition: List.h:329
bool push_back(T &&data)
Definition: List.h:146
Iterator erase(Iterator it)
Definition: List.h:290
typename std::allocator_traits< Alloc >::template rebind_alloc< Node > NodeAlloc
Definition: List.h:366
Node * createNode()
Definition: List.h:369
Iterator rend()
Definition: List.h:324
Node * firstDataNode()
Definition: List.h:387
Iterator rbegin()
Definition: List.h:319
bool pop_back()
Definition: List.h:242
T & operator[](int index)
Definition: List.h:339
void validate()
Definition: List.h:389
bool clear()
Definition: List.h:333
Definition: Allocator.h:13
List Node.
Definition: List.h:22
Node * next
Definition: List.h:23
T data
Definition: List.h:25
Node * prior
Definition: List.h:24