1、 map中插入数据
map<string,string> tempMap;
tempMap.insert(make_pair(map_key, map_value));
2、 遍历map元素
map<string, string>::iterator it;
for (it = tempMap.begin(); it != tempMap.end(); it++)
{
string key = it->first;
string value = it->second;
}
3、判断map中key值是否存在
if( ( it = tempMap.find(map_key) ) == tempMap.end() )
{
printf("key不存在");
}else{
printf("key存在");
}
4、vector中插入元素
vector<string> vec;
vec.push_back("111");
5、 遍历vector中元素
for(int i = 0;i < vec.size(); i++)
{
string s = vec.at(i);
}
6、判断vector中元素是否存在
if (std::find(vec.begin(), vec.end(), key) != vec.end()){
printf("key存在");
}