Create Time: 20th April 2024
Title: "[[Map]]"
status: UNFINISHED
Author:
- AllenYGY
tags:
- HashMap
- STL
- NOTE
created: 2024-04-20T11:27
updated: 2024-04-20T11:30
std::unordered_map<std::string, std::int> umap; //定义
umap.insert(Map::value_type("test", 1));//增加
//根据key删除,如果没找到n=0
auto n = umap.erase("test") //删除
auto it = umap.find(key) //改
if(it != umap.end())
it->second = new_value;
//map中查找x是否存在
umap.find(x) != map.end()//查
//或者
umap.count(x) != 0