stl遍历map

MapInfo* CGameConfig::getMapInfoById( int nId )
{
    for (map<int, MapInfo>::iterator it = m_mapMapInfo.begin(); it != m_mapMapInfo.end(); it++)
    {
        if (nId == it->first)
        {
            return &(it->second);
        }
    }
    CCLog("error: CGameConfig::getMapInfoById");
    return NULL;
}

 

你可能感兴趣的:(map)