diff --git a/src/stdgpu/impl/unordered_map_detail.cuh b/src/stdgpu/impl/unordered_map_detail.cuh index 5ff3247eb..e63238f30 100644 --- a/src/stdgpu/impl/unordered_map_detail.cuh +++ b/src/stdgpu/impl/unordered_map_detail.cuh @@ -358,6 +358,13 @@ unordered_map::clear(ExecutionPolicy&& policy _base.clear(std::forward(policy)); } +template +inline STDGPU_DEVICE_ONLY bool +unordered_map::occupied(const index_t n) const +{ + return _base.occupied(n); +} + template unordered_map unordered_map::createDeviceObject(const index_t& capacity, diff --git a/src/stdgpu/impl/unordered_set_detail.cuh b/src/stdgpu/impl/unordered_set_detail.cuh index 56989f4aa..71dbd760a 100644 --- a/src/stdgpu/impl/unordered_set_detail.cuh +++ b/src/stdgpu/impl/unordered_set_detail.cuh @@ -340,6 +340,13 @@ unordered_set::clear(ExecutionPolicy&& policy) _base.clear(std::forward(policy)); } +template +inline STDGPU_DEVICE_ONLY bool +unordered_set::occupied(const index_t n) const +{ + return _base.occupied(n); +} + template unordered_set unordered_set::createDeviceObject(const index_t& capacity, const Allocator& allocator) diff --git a/src/stdgpu/unordered_map.cuh b/src/stdgpu/unordered_map.cuh index a019f5ebb..dbf1f1b67 100644 --- a/src/stdgpu/unordered_map.cuh +++ b/src/stdgpu/unordered_map.cuh @@ -484,6 +484,14 @@ public: STDGPU_HOST_DEVICE key_equal key_eq() const; + /** + * \brief Checks if the given bucket is occupied + * \param[in] n The bucket index + * \return True if the bucket is occupied, false otherwise + */ + STDGPU_DEVICE_ONLY bool + occupied(const index_t n) const; + private: using base_type = detail::unordered_base, hasher, key_equal, Allocator>; diff --git a/src/stdgpu/unordered_set.cuh b/src/stdgpu/unordered_set.cuh index 5a2277f77..48909bfb0 100644 --- a/src/stdgpu/unordered_set.cuh +++ b/src/stdgpu/unordered_set.cuh @@ -473,6 +473,14 @@ public: STDGPU_HOST_DEVICE key_equal key_eq() const; + /** + * \brief Checks if the given bucket is occupied + * \param[in] n The bucket index + * \return True if the bucket is occupied, false otherwise + */ + STDGPU_DEVICE_ONLY bool + occupied(const index_t n) const; + private: using base_type = detail::unordered_base;