diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-02-01 09:48:31 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-01 09:48:31 +0100 |
| commit | 6e191a07bbc57d73152ba886b6f76f694a97e525 (patch) | |
| tree | b37718035e5a9b31bc3a5875b4e12a2305021a39 /List.cpp | |
| parent | 46b9e6f61275c4ed4cd2e8f319cad4f6bc73100f (diff) | |
| download | ft_containers-6e191a07bbc57d73152ba886b6f76f694a97e525.tar.gz ft_containers-6e191a07bbc57d73152ba886b6f76f694a97e525.tar.bz2 ft_containers-6e191a07bbc57d73152ba886b6f76f694a97e525.zip | |
src test dir, makefile, Added subject
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; -} |
