注意:1模板类中的函数有const,那么定义此函数时const必须要有
2定义模板类的函数时,template一定要有class
#ifndef _SQLIST_H_
#define _SQLIST_H_
#include
using namespace std;
const DEFAULT_SIZE=10;
enum StatusCode{RANGE_ERROR,SUCCESS,NOT_PRESENT,ENTRY_FOUND,OVER_FLOW};
template
class SqList
{
protected:
ElemType *ptr;
int count;
int maxSize;
void init(int size);
bool full()const;
public:
SqList(int size=DEFAULT_SIZE);
virtual ~SqList();
int length()const;
bool isEmpty()const;
void clear();
StatusCode setElem(int position,const ElemType &e);
StatusCode getElem(int position,ElemType &e)const;
StatusCode Insert(int position,const ElemType &e);
StatusCode Delete(int position,ElemType &e);
SqList(const SqL