golang中怎么刪除map中所有元素
2 回答

富國滬深
TA貢獻1790條經驗 獲得超9個贊
std::map<LONG,CBlinkPCHandle*>::iterator it;
for( it = m_mapUserLoginGUID.begin(); it != m_mapUserLoginGUID.end(); it ++)
{
if(it->second != NULL)
{
it->second->RemoveAll();
delete it->second;
}
m_mapUserLoginGUID.erase(it);
}
調用RemoveAll()刪除所有元素
- 2 回答
- 0 關注
- 1165 瀏覽
添加回答
舉報
0/150
提交
取消