您的位置:首页 > 其它

自定义std::set比较函数的例子

2007-07-09 14:13 267 查看
自定义std::set比较函数的例子

struct GenStatus
{
DWORD dwId;
DWORD dwLastHitTick;

GenStatus() : dwId(0), dwLastHitTick(0){}
static unsigned int inline GetRefeshInterval() {return T_REFRESH_TIME;}
bool CheckRefreshTime(){return GetTickCount() - dwLastHitTick > GetRefeshInterval();}
};

typedef struct GenStatus *PGenStatus;
struct Comp_GenStatus
{
bool operator()(const PGenStatus p1, const PGenStatus p2) const
{
return p1->dwId - p2->dwId < 0;
}
};

typedef std::set<PGenStatus, Comp_GenStatus> GEN__STATUS_SET;
typedef std::map<PGenStatus, Comp_GenStatus> GEN__STATUS_MAP;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: