C++中map的一点疑惑...
2016-06-30 11:11
423 查看
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
{
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
相关文章推荐
- c++继承中拷贝构造问题
- C++虚函数与纯虚函数
- Function Table 函数指针表
- debug c++ 经验积累(1)-double free or corruption (!prev)
- leetcode 3sum算法
- 函数指针参数的传递问题
- C++ 在继承中虚函数、纯虚函数、普通函数,三者的区别
- C语言中生产随机数 rand()函数
- C++ 11 Lambda表达式
- leetcode #160 in cpp
- C++中数字与字符串之间的转换
- c++内存对齐原理
- VC++发展与其对应的MFC版本
- C++ 类的继承四(类继承中的重名成员)
- 值得推荐的C/C++框架和库
- C++ 11 nullptr关键字
- C++ link error : undefined reference to 'vtable for ...'
- vc和MFC的详细历史
- C++ 11 auto关键字
- C语言不定长数组及初始化