#include struct Node { int value; Node* next; }; // TODO: Implement the Iterator class here class List { public: List() : top {} {} ~List() { while (top != nullptr) { Node* tmp {top->next}; delete top; top = tmp; } } void add(int i) { top = new Node{i, top}; } // TODO: Extend the List class here. private: Node* top; }; int main() { List list {}; list.add(3); list.add(2); list.add(7); list.add(4); list.add(1); *(++list.begin()) = 12; for (auto it {list.begin()}; !(it == list.end()); ++it) { std::cout << *it << " "; } std::cout << std::endl; }