📜  std::map 获取所有键 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.443000             🧑  作者: Mango

代码示例1
std::map m;
std::vector key, value;
for(std::map::iterator it = m.begin(); it != m.end(); ++it) {
  key.push_back(it->first);
  value.push_back(it->second);
  std::cout << "Key: " << it->first << std::endl();
  std::cout << "Value: " << it->second << std::endl();
}