From 9892f41a81944df04575a6a588be5df340b07e48 Mon Sep 17 00:00:00 2001 From: Alrik Appelfeldt <alrap417@student.liu.se> Date: Tue, 5 Mar 2024 17:01:21 +0000 Subject: [PATCH] =?UTF-8?q?klar=20h=20fil=20f=C3=B6r=20redovisning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list/linked_list.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 list/linked_list.h diff --git a/list/linked_list.h b/list/linked_list.h new file mode 100644 index 0000000..1cd4cb1 --- /dev/null +++ b/list/linked_list.h @@ -0,0 +1,55 @@ +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + + + +#include<iostream> +#include <initializer_list> +#include <string> +#include <sstream> +#include <iostream> +#include <iomanip> +using namespace std; + +class List { +public: + +List(); +List(std::initializer_list<int> const &list); +List(List const& rhs); +List(List&& rhs); +~List(); + +int at(int const& i) const; +void remove(int const& pos); +int get_size()const; +void Insert_Node(int insert_value); +bool List_Is_Empty(); +List& operator =(List const& rhs); +List& operator =(List&& rhs); + +class Node { +public: + int value; + Node* next{nullptr}; + Node* previous{nullptr}; + Node(int insert_value); + + +}; + +Node* head{nullptr}; +Node* tail{nullptr}; +int list_size {}; +void printlist(); +int get_size(); +}; + +std::ostream& operator << (std::ostream& os, List const& rhs); + + + + +#endif + + -- GitLab