Skip to content

Commit

Permalink
Expose key_eq member accessors (#584)
Browse files Browse the repository at this point in the history
Currently, `key_eq` is only accessible in ref classes, not in container
classes. This PR addresses the issue by exposing `key_eq` in all
classes.
  • Loading branch information
PointKernel authored Aug 23, 2024
1 parent d347766 commit 9fe6c82
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/cuco/detail/static_map/static_map.inl
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,21 @@ static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::
return impl_->erased_key_sentinel();
}

template <class Key,
class T,
class Extent,
cuda::thread_scope Scope,
class KeyEqual,
class ProbingScheme,
class Allocator,
class Storage>
constexpr static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::key_equal
static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::key_eq()
const noexcept
{
return impl_->key_eq();
}

template <class Key,
class T,
class Extent,
Expand Down
16 changes: 16 additions & 0 deletions include/cuco/detail/static_multimap/static_multimap.inl
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ constexpr static_multimap<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Alloca
return impl_->erased_key_sentinel();
}

template <class Key,
class T,
class Extent,
cuda::thread_scope Scope,
class KeyEqual,
class ProbingScheme,
class Allocator,
class Storage>
constexpr static_multimap<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::
key_equal
static_multimap<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::key_eq()
const noexcept
{
return impl_->key_eq();
}

template <class Key,
class T,
class Extent,
Expand Down
15 changes: 15 additions & 0 deletions include/cuco/detail/static_multiset/static_multiset.inl
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,21 @@ static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>
return impl_->erased_key_sentinel();
}

template <class Key,
class Extent,
cuda::thread_scope Scope,
class KeyEqual,
class ProbingScheme,
class Allocator,
class Storage>
constexpr static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::
key_equal
static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::key_eq()
const noexcept
{
return impl_->key_eq();
}

template <class Key,
class Extent,
cuda::thread_scope Scope,
Expand Down
13 changes: 13 additions & 0 deletions include/cuco/detail/static_set/static_set.inl
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ static_set<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::era
return impl_->erased_key_sentinel();
}

template <class Key,
class Extent,
cuda::thread_scope Scope,
class KeyEqual,
class ProbingScheme,
class Allocator,
class Storage>
constexpr static_set<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::key_equal
static_set<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::key_eq() const noexcept
{
return impl_->key_eq();
}

template <class Key,
class Extent,
cuda::thread_scope Scope,
Expand Down
7 changes: 7 additions & 0 deletions include/cuco/static_map.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,13 @@ class static_map {
*/
[[nodiscard]] constexpr key_type erased_key_sentinel() const noexcept;

/**
* @brief Gets the function used to compare keys for equality
*
* @return The function used to compare keys for equality
*/
[[nodiscard]] constexpr key_equal key_eq() const noexcept;

/**
* @brief Get device ref with operators.
*
Expand Down
7 changes: 7 additions & 0 deletions include/cuco/static_multimap.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,13 @@ class static_multimap {
*/
[[nodiscard]] constexpr key_type erased_key_sentinel() const noexcept;

/**
* @brief Gets the function used to compare keys for equality
*
* @return The function used to compare keys for equality
*/
[[nodiscard]] constexpr key_equal key_eq() const noexcept;

/**
* @brief Get device ref with operators.
*
Expand Down
7 changes: 7 additions & 0 deletions include/cuco/static_multiset.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,13 @@ class static_multiset {
*/
[[nodiscard]] constexpr key_type erased_key_sentinel() const noexcept;

/**
* @brief Gets the function used to compare keys for equality
*
* @return The function used to compare keys for equality
*/
[[nodiscard]] constexpr key_equal key_eq() const noexcept;

/**
* @brief Get device ref with operators.
*
Expand Down
7 changes: 7 additions & 0 deletions include/cuco/static_set.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,13 @@ class static_set {
*/
[[nodiscard]] constexpr key_type erased_key_sentinel() const noexcept;

/**
* @brief Gets the function used to compare keys for equality
*
* @return The function used to compare keys for equality
*/
[[nodiscard]] constexpr key_equal key_eq() const noexcept;

/**
* @brief Get device ref with operators.
*
Expand Down

0 comments on commit 9fe6c82

Please sign in to comment.