Allocate a number of buckets.
| 580 | |
| 581 | // Allocate a number of buckets. |
| 582 | void AllocateStorage(size_t num_buckets) { |
| 583 | num_buckets_ = num_buckets; |
| 584 | data_ = allocfn_.allocate(num_buckets_); |
| 585 | owns_data_ = true; |
| 586 | for (size_t i = 0; i < num_buckets_; ++i) { |
| 587 | allocfn_.construct(allocfn_.address(data_[i])); |
| 588 | emptyfn_.MakeEmpty(data_[i]); |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | void DeallocateStorage() { |
| 593 | if (owns_data_) { |