Description: #include<iostream>
using namespace std
template<class T>
class list{
private:
int n
int max_size
T*data
public:
list(int max_list_size=10)
~list(){delete [] data }
bool empty()const {return n==0 }
int size()const {return n }
int locate(const T&x)const
bool retrieve(int k,T&x)const
list<T> & insert(int k,const T&x)
list<T> & erase(int k,T&x)
void print_list(ostream& out)const
} //类函数
template<class T>
list<T>::list(int max_list_size)
{
max_size=max_list_size
data=new T[max_size]
n=0
}
template<class T>
int list<T>::locate(const T&x)const
{
for(int i=0 i<n i++)
if(data[i]==x)return++i
return 0
}
template<class T>
bool list<T>::retrieve(int k,T&x)const
{
if(k<1||k>n)return false
x=data[k-1]
return true
}
template<class T>
list<T>&list<T>::insert(int k,const T&x)
{
if(k<0||k>n)//throw out_bounds()
To Search:
File list (Check if you may need any files):
abc.cpp.txt