怎么做模板Map和函数?

Sander Sander 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#ifndef __MapWrapper_H__
#define __MapWrapper_H__
#if (defined(WIN32) || defined(_WIN32_WCE))
#pragma warning(disable:4786)
#include "WTYPES.H" //HANDLE
#else
#include <pthread.h> //multiple thread
#endif
#include <map>

template <class T>
//typedef std::map<T, void*> MAPObj;
//template <class Type>

class CMapWrapper
{
public:
CMapWrapper();
virtual ~CMapWrapper();

bool InsertToMap(T id, void* pObj);
bool ReplaceToMap(T id, void* pObj);
bool IsInMap(T id);

bool RemoveObjFrmMap(T id);
void* GetNextObj(bool bFirst=false);
void* FindObjVidID(T id);
private:
//MAPObj m_ObjMap;
typename std::map<T,void*> m_ObjMap;
#if (defined(WIN32) || defined(_WIN32_WCE))
HANDLE m_hMapMutex;
#else
pthread_mutex_t m_data_mutex;
#endif

};
#endif
...全文
评论 5
收藏 已收藏
分享
返回顶部
Sander
VC/MFC 16,550 成员 421,606 内容