Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个std::unordered_multiset<int>which is namedhashTable和一个 bucket i。我可以遍历ith 桶的元素吗?
std::unordered_multiset<int>
hashTable
i
您确实可以使用本地迭代器遍历每个存储桶:
for (auto it = hashTable.cbegin(i); it != hashTable.cend(i); ++it) { // ... use *it }
确保i位于范围内[0, hashTable.bucket_count())。
[0, hashTable.bucket_count())