C++中map的一点疑惑...

时间:2024-01-12 15:44:56

int CRuntimePara::getInt(const string& strKey,int iDefault)
{
map<string,string>::const_iterator iter;

if ((iter = _mapParaValue.find(strKey)) != _mapParaValue.end())
return atoi((*iter).second.c_str());
else
return iDefault;
}

_mapParaValue.end()

-----------------------------------------------------------------------------------------

class CRuntimePara
{

...

private:
std::map<std::string,std::string> _mapParaValue;
};

------------------------------------------------------------------------------------------

_mapParaValue.end()为map里的end的返回置为Returns an iterator referring to the past-the-end element in the map container.返回指向_mapParaValue容器尾元素之后位置的迭代器               若begin == end