#include #include template struct Node { T value; Node* next = nullptr; Node* prev = nullptr; }; template class List { private: Node* start = nullptr; Node* end = nullptr; public: List() { Node* start = nullptr; Node* end = nullptr; } void add(T value) { Node* node = new Node; node->value = value; if(start==nullptr) { start = node; end = node; return; } node->prev = end; end->next = node; end = node; } void pop() { end = end->prev; end->next = nullptr; } friend std::ostream &operator <<(std::ostream &os, List &c) { os << "( "; Node* currentNode = c.start; while (currentNode->next!=nullptr) { os << currentNode->value << " = "; currentNode = currentNode->next; } os << currentNode->value << " )"; delete currentNode; return os; } };