C++ Vector线性表的数组实现
STL中的Vector容器就是线性表的数组实现,因为最近学习数据结构,于是手工实现了一遍数组描述的线性表 // 2020/02/14 Tealer.Guo #include <algorithm> // copy(), find(), copy_backward() #include <iostream> #include <iterator> // ostream_iterator<> // 线性表 // ADT 抽象数据类型 // 纯虚函数 template<typename T> class linearList { public: virtual ~linearList() {}; virtual bool empty() const = 0; // 当线性表为空时,返回0 virtual int size() const = 0; // 返回线性表的元素个数 virtual T& get(int this_index) const = 0; // 返回具有this_index索引的元素 virtual int indexOf(const T& this_elem) const = 0; // 返回元素的索引 virtual void erase(int this_index) = 0; // 删除该索引的元素 virtual void insert(int this