📄 listex.h
字号:
//ListEx.h
#ifndef _LIST_EX_H_
#define _LIST_EX_H_
///////////////////////////////////////////////////////////////////////////////
/*///////////////////////////////////////////////////////////////////////////* /
#if defined(__cplusplus)
extern "C" {
#endif
/*///////////////////////////////////////////////////////////////////////////*/
///////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
/////////////////////////////////////////////
/////////////////////////////////////////////
#pragma warning(disable: 4786)
#include <map>
#include <list>
#include <string>
using namespace std;
////////////////////////////////////////////
#define nil 0
////////////////////////////////////////////
////////////////////////////////////////////
//template
//Key(char*) -- You can use a data type such as char* as a Key
//Value(class) -- You can use a self-define type such as class as a Value
template< typename Key, typename Value >
class CListEx {
public:
CListEx(long size=0);
virtual ~CListEx();
public:
virtual void insert(Key key,Value value);
virtual void push(Key key,Value value);
virtual void remove(Key key);
virtual void remove_all();
virtual void clear();
virtual void erase(Key key);
virtual bool find(Key key, Value& value);
virtual long count();
virtual Value operator[](long index);
private:
virtual bool get(Key &key,Value &value,long index);
private:
map<Key,Value> m_map;
};
///////////////////////////////////////////////////////////////////////////////
typedef long Key;
typedef void * Value;
typedef CListEx<Key, Value> LongVoidLists;
///////////////////////////////////////////////////////////////////////////////
/*///////////////////////////////////////////////////////////////////////////* /
#if defined(__cplusplus)
}
#endif
/*///////////////////////////////////////////////////////////////////////////*/
///////////////////////////////////////////////////////////////////////////////
#endif //_LIST_EX_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -