firemail
标题:
结构体做为map的key
[打印本页]
作者:
jimu
时间:
2016-5-2 12:09
标题:
结构体做为map的key
typedef struct tagRoadKey
{
int nType;
int nScale;
bool operator <(const tagRoadKey& other) const
{
if (nType < other.nType) //类型按升序排序
{
return true;
}
else if (nType == other.nType) //如果类型相同,按比例尺升序排序
{
return nScale < other.nScale;
}
return false;
}
}ROADKEY;
typedef struct _stPmssKey
{
__int64 NeSysId;
int nPsmmKeep;
int nPsmmPilotSet;
int nCarr;
int nPsmmCell;
int nPsmmSector;
bool operator < (const _stPmssKey& other) const
{
if (NeSysId != other.NeSysId)
{
return NeSysId < other.NeSysId;
}
else if (nPsmmKeep != other.nPsmmKeep)
{
return nPsmmKeep < other.nPsmmKeep;
}
else if (nPsmmPilotSet != other.nPsmmPilotSet)
{
return nPsmmPilotSet < other.nPsmmPilotSet;
}
else if (nCarr != other.nCarr)
{
return nCarr < other.nCarr;
}
else if (nPsmmCell != other.nPsmmCell)
{
return nPsmmCell < other.nPsmmCell;
}
else if (nPsmmSector != other.nPsmmSector)
{
return nPsmmSector < other.nPsmmSector;
}
return false;
}
} stPmssKey,*PPmssKey;
复制代码
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3