#include "List/List.h" #include template class CircleList: public List { public: Node* get_start() { return this->start; } CircleList() {} void add (T value) override{ Node* node = new Node; node->value = value; if(this->start==nullptr) { this->start = node; this->end = node; return; } node->prev = this->end; node->next = this->start; this->end->next = node; this->start->prev = node; this->end = node; this->lenght++; } void add (T value, int index) override{ static_cast*>(this)->add(value, index); return; } void pop(Node* n) { this->pop(n); } void pop() { this->end->prev->next = this->start; this->end = this->end->prev; this->lenght--; } void pop(int index) { this->pop(index); } friend std::ostream &operator <<(std::ostream &os, CircleList &c) { os << "( "; Node* currentNode = c.start; for(int i = 0; i < c.lenght; i++) { os << currentNode->value << " = "; currentNode = currentNode->next; } os << currentNode->value << "... )"; return os; } };