#ifndef _LIST_H_ #define _LIST_H_ #include #include // TDDE18 - Lab 6 - Templates // Header file template class List { public: List(); ~List() { delete first; } void insert(T const& d); List(List const&); List(List&&); List& operator=(List const&); List& operator=(List&&); private: class Link { public: Link(T const& d, Link* n) : data(d), next(n) {} ~Link() { delete next; } friend class List; static Link* clone(Link const*); private: T data; Link* next; }; Link* first; public: using value_type = T; class Iterator { friend List; public: Iterator& operator++(); T& operator*() const; bool operator!=(Iterator const& other) const; bool operator==(Iterator const& other) const; private: // Private constructor Iterator(Link* ln); Link* l; }; Iterator begin() const; Iterator end() const; }; template std::ostream& operator<<(std::ostream& os, const List& lst); #include "list.tcc" #endif