Creates a new bucket to store `value` and inserts it at `index`. If the `index` is past the end, the bucket is inserted at the end of the vector.
| 421 | // If the `index` is past the end, the bucket is inserted at the end of the |
| 422 | // vector. |
| 423 | void InsertBucketFor(size_t index, T value) { |
| 424 | const T bucket_start = ComputeBucketStart(value); |
| 425 | Bucket bucket = {1ULL << ComputeBucketOffset(value), bucket_start}; |
| 426 | auto it = buckets_.emplace(buckets_.begin() + index, std::move(bucket)); |
| 427 | #if defined(NDEBUG) |
| 428 | (void)it; // Silencing unused variable warning. |
| 429 | #else |
| 430 | assert(std::next(it) == buckets_.end() || |
| 431 | std::next(it)->start > bucket_start); |
| 432 | assert(it == buckets_.begin() || std::prev(it)->start < bucket_start); |
| 433 | #endif |
| 434 | } |
| 435 | |
| 436 | // Returns true if the bucket at `bucketIndex/ stores the enum at |
| 437 | // `bucketOffset`, false otherwise. |