Arraylist 类模版

时间:2013-12-02 00:06:13
【文件属性】:
文件名称:Arraylist 类模版
文件大小:49KB
文件格式:RAR
更新时间:2013-12-02 00:06:13
c++ private: typedef T ItemType; // int typedef ItemType* pItemType; typedef pItemType* ppItemType; ppItemType items; // size_t count; int count; // Finds the index of the next item in order. int FindNextIndex(const int start, const SortOrder order) const; // Swaps the two items at the given indices. void SwapItems(const int index1, const int index2); // Copies the parameter list. void CopyList(const ArrayList& copyArrayList); // Deletes all allocated memory. void DeleteList(); // Displays the items in the array, one per line. friend ostream& operator <<<>(ostream& out, const ArrayList& anArrayList); public: // Sets items to NULL and count to 0. ArrayList(); // Initializes object to the parameter object. ArrayList(const ArrayList& copyArrayList); // Deletes all allocated memory. ~ArrayList(); // Assigns the parameter object to the current object. ArrayList operator =(const ArrayList& assignArrayList); // Adds and item and returns added item. Array is resized by one. pItemType Add(pItemType anItem); // Removes the item at the given index. Array is resize by one. void RemoveItemAtIndex(const int index); // Returns the item at the given index. pItemType ItemAtIndex(const int index) const; // Returns the size of the array. int Count() const; // Sorts array in either ascending/descending order. void Sort(const SortOrder order);
【文件预览】:
p04-Templates
----p04.docx(52KB)
----~$p04.docx(162B)
----p04.cpp(1KB)
----ArrayList.h(2KB)

网友评论