aboutsummaryrefslogtreecommitdiff
path: root/list.hpp
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-31 12:46:19 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-31 12:46:19 +0100
commit46b9e6f61275c4ed4cd2e8f319cad4f6bc73100f (patch)
treec33522b5337b0214154232870eaa830b3f0e4108 /list.hpp
parentf89b202792c118a0baa5fb7f4978dbc2077b64d4 (diff)
downloadft_containers-46b9e6f61275c4ed4cd2e8f319cad4f6bc73100f.tar.gz
ft_containers-46b9e6f61275c4ed4cd2e8f319cad4f6bc73100f.tar.bz2
ft_containers-46b9e6f61275c4ed4cd2e8f319cad4f6bc73100f.zip
List split cpp hpp (may be ridiculous and may have forgot how templates work)
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