diff options
Diffstat (limited to 'List.cpp')
| -rw-r--r-- | List.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/List.cpp b/List.cpp deleted file mode 100644 index f88ca36..0000000 --- a/List.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "List.hpp" - -ft::List::List(const allocator_type& alloc = allocator_type()) -{ - front = nullptr; - back = nullptr; - size = 0; - -} - -ft::List::~List() -{ - while (size > 0) - pop_front(); -} - -ft::List::bool empty() const -{ - return front == nullptr; -} -ft::List::size_type size() const -{ - return size; -} - -ft::List::reference front() -{ - return *front; -} - -ft::List::reference back() -{ - return *back; -} - -ft::List::void push_front (const value_type& val) -{ - PrivateList *nfront = new PrivateList(val); - nfront->next = front; - front = nfront; - if (back == nullptr) - back = front; - size++; -} - -ft::List::void pop_front() -{ - t_llist *nfront = front->next; - if (size == 1) - back = nullptr; - delete front; - front = nfront; - size--; -} - -ft::List::void push_back (const value_type& val) -{ - PrivateList *nback = new PrivateList(val); - if (empty()) - { - back = nback; - front = back; - return; - } - back->next = nback; - back = nback; - size++; -} - -ft::List::void pop_back() -{ - t_llist *tmp = front; - - while (tmp->next != back) - tmp = tmp->next; - delete back; - back = tmp; -} - -ft::List::PrivateList::PrivateList(const value_type& val); -{ - next = nullptr; - val = val; -} - -ft::List::PrivateList::~PrivateList() -{ - delete val; -} |
