Skip to content

Commit

Permalink
Add ref key_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Dec 5, 2023
1 parent fe6e0e0 commit 6ecc9b4
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class open_addressing_ref_impl {
*
* @return The comparator used to compare keys
*/
[[nodiscard]] __device__ constexpr key_equal key_eq() const noexcept
[[nodiscard]] __host__ __device__ constexpr key_equal key_eq() const noexcept
{
return this->predicate().equal_;
}
Expand Down
20 changes: 20 additions & 0 deletions include/cuco/detail/static_map/static_map_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ __host__ __device__ constexpr static_map_ref<Key,
{
}

template <typename Key,
typename T,
cuda::thread_scope Scope,
typename KeyEqual,
typename ProbingScheme,
typename StorageRef,
typename... Operators>
__host__ __device__ constexpr static_map_ref<Key,
T,
Scope,
KeyEqual,
ProbingScheme,
StorageRef,
Operators...>::key_equal
static_map_ref<Key, T, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::key_eq()
const noexcept
{
return this->impl_.key_eq();
}

template <typename Key,
typename T,
cuda::thread_scope Scope,
Expand Down
18 changes: 18 additions & 0 deletions include/cuco/detail/static_set/static_set_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ __host__ __device__ constexpr static_set_ref<Key,
{
}

template <typename Key,
cuda::thread_scope Scope,
typename KeyEqual,
typename ProbingScheme,
typename StorageRef,
typename... Operators>
__host__ __device__ constexpr static_set_ref<Key,
Scope,
KeyEqual,
ProbingScheme,
StorageRef,
Operators...>::key_equal
static_set_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::key_eq()
const noexcept
{
return this->impl_.key_eq();
}

template <typename Key,
cuda::thread_scope Scope,
typename KeyEqual,
Expand Down
7 changes: 7 additions & 0 deletions include/cuco/static_map_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ class static_map_ref
*/
[[nodiscard]] __host__ __device__ constexpr mapped_type empty_value_sentinel() const noexcept;

/**
* @brief Gets the key comparator.
*
* @return The comparator used to compare keys
*/
[[nodiscard]] __host__ __device__ constexpr key_equal key_eq() const noexcept;

/**
* @brief Creates a reference with new operators from the current object.
*
Expand Down
7 changes: 7 additions & 0 deletions include/cuco/static_set_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ class static_set_ref
*/
[[nodiscard]] __host__ __device__ constexpr key_type empty_key_sentinel() const noexcept;

/**
* @brief Gets the key comparator.
*
* @return The comparator used to compare keys
*/
[[nodiscard]] __host__ __device__ constexpr key_equal key_eq() const noexcept;

/**
* @brief Creates a reference with new operators from the current object.
*
Expand Down

0 comments on commit 6ecc9b4

Please sign in to comment.