From 0ada48f859ab59acdbd67e67e887026cacc29e33 Mon Sep 17 00:00:00 2001 From: Stoycho Kyosev Date: Wed, 9 Nov 2022 22:56:24 +0200 Subject: add Seminar06 --- Seminar06/DLLSkeleton.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Seminar06/DLLSkeleton.cpp (limited to 'Seminar06/DLLSkeleton.cpp') diff --git a/Seminar06/DLLSkeleton.cpp b/Seminar06/DLLSkeleton.cpp new file mode 100644 index 0000000..77811b8 --- /dev/null +++ b/Seminar06/DLLSkeleton.cpp @@ -0,0 +1,70 @@ +#ifndef DOUBLY_LINKED_LIST_IMPL_ +#define DOUBLY_LINKED_LIST_IMPL_ + +#include + +template +class DoublyLinkedList { +private: + struct DLListNode {}; + + using Node = DLListNode; + + Node* head; + Node* tail; + + void copy(const DoublyLinkedList& other); + void free(); + + class Iterator { + private: + Node* current; + Iterator(Node* c) {} + + public: + Iterator& operator++() {} + + Iterator operator++(int) {} + + Iterator& operator--() {} + + Iterator operator--(int) {} + + const T& operator*() {} + + bool operator==(const Iterator& other) const {} + + bool operator!=(const Iterator& other) const {} + + friend class DoublyLinkedList; + }; + +public: + DoublyLinkedList(); + + DoublyLinkedList(const DoublyLinkedList&); + DoublyLinkedList& operator=(const DoublyLinkedList&); + + DoublyLinkedList(DoublyLinkedList&&); + DoublyLinkedList& operator=(DoublyLinkedList&&); + + void pushBack(const T&); + void popBack(); + + void pushFront(const T&); + void popFront(); + + bool empty() const; + + const T& back() const; + const T& front() const; + + Iterator begin(); + Iterator end(); + + void insert(Iterator at, const T& elem); + + ~DoublyLinkedList(); +}; + +#endif \ No newline at end of file -- cgit v1.3.1-23-gd82d