c++:遍历 std::hash_map 的顺序

标签 c++ stl hashmap

遍历映射保证按顺序完成(根据定义的比较函数)。

例如,hash_map 怎么样,从 begin()end() 迭代时是否有保证的顺序?

最佳答案

不,hash_map 或标准的等效 std::unordered_map 是一个无序 容器。

关于c++:遍历 std::hash_map 的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17324630/

相关文章:

c++ - 为什么 stack<const string> 不能在 g++ 中编译?

C++初始化对映射

c++ - DirectShow 和佳能 EOS 5D Mark II

c++ - 在 C++ 中多线程时出现 "no matching function call"错误

c++ - 为什么输出包含 - 在这个程序中?

c++11 - 对<string,string>的删除赋值运算符的g++编译器错误

performance - IndexedDB 访问速度和效率

java - Java 方法是否可以使用单个参数来接收 HashMap<String, Integer> 和 HashMap<Long, Integer> 的值?

java - 循环遍历 HashMaps Java 的 ArrayList

c++ - MS VC++ OpenSSL SSL_read() 阻塞