From 677a3cbec2f7908ee0897b97d508a6bd66a0a344 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Fri, 21 Mar 2025 20:54:14 -0400 Subject: pke: first-pass level is a collection of scenes --- src/bucketed-array.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/bucketed-array.hpp') diff --git a/src/bucketed-array.hpp b/src/bucketed-array.hpp index fb24712..150fa66 100644 --- a/src/bucketed-array.hpp +++ b/src/bucketed-array.hpp @@ -14,8 +14,18 @@ struct BucketContainer { CT limits; CT pkeHandle; T* buckets[BKT_CNT]; + T& operator[](CT) const; }; +template +T& +BucketContainer::operator[](CT handle) const { + assert(handle.bucketIndex < this->limits.bucketIndex); + assert(handle.itemIndex < this->limits.itemIndex); + assert(handle.bucketIndex != this->pkeHandle.bucketIndex || handle.itemIndex < this->pkeHandle.itemIndex); + return this->buckets[handle.bucketIndex][handle.itemIndex]; +} + template void Buckets_Init(BucketContainer &bktContainer, size_t maxItemCount = BucketContainerDefaultItemCount) { bktContainer.limits.bucketIndex = BKT_CNT; -- cgit v1.2.3