aboutsummaryrefslogtreecommitdiff
path: root/list.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'list.hpp')
-rw-r--r--list.hpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/list.hpp b/list.hpp
deleted file mode 100644
index c8645b4..0000000
--- a/list.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef LIST_HPP
-# define LIST_HPP
-
-namespace ft
-{
- template < class T, class Alloc = allocator<T> >
- class list
- {
- public:
- bool empty() const
- {
- return front == nullptr;
- }
- size_type size() const
- {
- return size;
- }
-
- reference front()
- {
- return *front;
- }
- reference back()
- {
- return *back;
- }
- void push_front (const value_type& val)
- {
- t_inner_list *nfront = new t_inner_list;
- nfront->content = val;
- nfront->next = front;
- front = nfront;
- if (back == nullptr)
- back = front;
- size++;
- }
- void pop_front()
- {
- t_inner_list *nfront = front->next;
- if (nfront == nullptr)
- back = nullptr;
- ~T(front->content);
- delete front;
- front = nfront;
- size--;
- }
- void push_back (const value_type& val)
- {
- t_inner_list *nback = new t_inner_list;
- nback->content = val;
- if (back == nullptr)
- {
- back = nback;
- front = back;
- return;
- }
- back->next = nback;
- back = nback;
- size++;
- }
- void pop_back()
- {
-
- }
-
- private:
- typedef struct
- {
- t_inner_list *next;
- T content;
- } t_inner_list;
- t_inner_list *front;
- t_inner_list *back;
- size_type size;
- };
-}
-
-#endif