// ------------------------------------------------------------------------ // A cell contains a T* and a link. Cells are used to build lists. // A. Fischer June 13, 2000 file: cell.hpp // ------------------------------------------------------------------------ #pragma once #include #include "item.hpp" using namespace std; template class Linear; // ------------------------------------------------------------------------ template class Cell { friend class Linear ; private: // ------------------------------------------------------------ Item data; Cell* next; Cell() : data(), next(nullptr) {} Cell(T* ep, Cell* p = nullptr) : data(ep), next(p){ } ~Cell() { cout << "\n Deleting Cell " << this << dec << "..."; } public: ostream& print(ostream& out) const { // -------------------------------- return out << "Cell " << this << " [" << data << ", " << next << "]\n"; } }; template inline ostream& operator<<(ostream& out, const Cell& c){return c.print(out);}