set.h
来自「该压缩文件夹内有诸多常用算法和数据结构的c++模板编程实现」· C头文件 代码 · 共 37 行
H
37 行
#ifndef SET_H
#define SET_H
#include "LinkedList.h"
template<class T>
class Set
{
public:
bool put(T e)
{
if (list.find(e)==-1)
{
list.add(e);
return true;
}
return false;
}
T get(int index)
{
list.get(index);
}
int size()
{
return list.size();
}
bool remove(int index)
{
return list.remove(index);
}
void clear()
{
list.clear();
}
protected:
LinkedList<T> list;
private:
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?