Reserve enough room to insert until Size() == num_elements without requiring to grow the hash set. No-op if the hash set is already large enough to do this.
| 436 | // Reserve enough room to insert until Size() == num_elements without requiring to grow the hash |
| 437 | // set. No-op if the hash set is already large enough to do this. |
| 438 | void Reserve(size_t num_elements) { |
| 439 | size_t num_buckets = num_elements / max_load_factor_; |
| 440 | // Deal with rounding errors. Add one for rounding. |
| 441 | while (static_cast<size_t>(num_buckets * max_load_factor_) <= num_elements + 1u) { |
| 442 | ++num_buckets; |
| 443 | } |
| 444 | if (num_buckets > NumBuckets()) { |
| 445 | Resize(num_buckets); |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | // To distance that inserted elements were probed. Used for measuring how good hash functions |
| 450 | // are. |
nothing calls this directly
no outgoing calls
no test coverage detected