111,125
社区成员
发帖
与我相关
我的任务
分享
typedef CMyList<PER_HANDLE_CONTEXT*,PER_HANDLE_CONTEXT > Contextlist;
using Contextlist = CMyList<PerHandleContext, PerHandleContext>;
namespace DemoClassLibrary
{
using Contextlist = CMyList<PerHandleContext, PerHandleContext>;
/// <summary>
/// TODO: Update summary.
/// </summary>
public class Demo
{
public void foo()
{
Contextlist contextList = new MyList<PerHandleContext, PerHandleContext>();
}
}
}
template <class theCL,class CL>
class CMyList
{
public:
//创建一个list容器的实例LISTINT
typedef list<theCL> myList;
// typedef list<int (*callback)(int,char*)> myList;
CMyList(void);
~CMyList(void);
int LinkCount;
myList useList;
myList BakList;
//销毁
void DestroyList();
//重置为空表
void ClearList();
//加在头节点
BOOL AddFirst(theCL e);
//加在头节点
BOOL AddBakFirst(theCL e);
//加在尾节点
BOOL AddLast(theCL e);
//取得头
theCL GetFirst();
//取得尾部
theCL GetLast();
//移除头
BOOL RemoveFirst();
//移除尾部
BOOL RemoveLast();
//第i个位置之前插入
BOOL InsertAt(int i,theCL e);
//删除第I个
BOOL ListDelete(int i);
//元素的数量
int GetCount();
//取得第i个元素
theCL GetAt(int i);
//删除元素
BOOL ListDelete(theCL e);
BOOL SetAt(int i,theCL e);
//取得头
theCL GetBakFirst();
BOOL RemoveBakFirst();
//元素的数量
int GetTempCount();
};
using System.Collections.Generic;
/// <summary>
/// TODO: Update summary.
/// </summary>
public abstract class CMyList<theCL, CL>
{
public CMyList()
{
}
~CMyList()
{
}
public int LinkCount;
public List<theCL> useList;
public List<theCL> BakList;
public abstract void DestroyList();
public abstract void ClearList();
public abstract bool AddFirst(theCL e);
public abstract bool AddBakFirst(theCL e);
public abstract bool AddLast(theCL e);
public abstract theCL GetFirst();
public abstract theCL GetLast();
public abstract bool RemoveFirst();
public abstract bool RemoveLast();
public abstract bool InsertAt(int i, theCL e);
public abstract bool ListDelete(int i);
public abstract int GetCount();
public abstract theCL GetAt(int i);
public abstract bool ListDelete(theCL e);
public abstract bool SetAt(int i, theCL e);
public abstract theCL GetBakFirst();
public abstract bool RemoveBakFirst();
public abstract int GetTempCount();
}
typedef CMyList<PER_HANDLE_CONTEXT*,PER_HANDLE_CONTEXT > Contextlist;
public class PerHandleContext
{
}
typedef CMyList<PER_HANDLE_CONTEXT*,PER_HANDLE_CONTEXT > Contextlist;
typedef CMyList<PER_HANDLE_CONTEXT*,PER_HANDLE_CONTEXT > Contextlist;
namespace DemoClassLibrary
{
using Contextlist = CMyList<PerHandleContext, PerHandleContext>;
public class Demo
{
public void foo()
{
Contextlist = new Contextlist();
//......
//......
}
}
}