Make begin() to return end() on empty tables. (#297)

Eliminate performance overhead in constructing begin() iterators on empty hash tables.
This commit is contained in:
wind
2026-04-08 13:28:28 +08:00
committed by GitHub
parent 8442f1c82c
commit 01c838b76a
2 changed files with 20 additions and 0 deletions
+1
View File
@@ -1245,6 +1245,7 @@ public:
~raw_hash_set() { destroy_slots(); }
iterator begin() {
if (empty()) return end();
auto it = iterator_at(0);
it.skip_empty_or_deleted();
return it;