Skip to content

Commit

Permalink
Rename with_key_eq as rebind_key_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Sep 1, 2024
1 parent d49ff64 commit 75e1ac3
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 11 deletions.
21 changes: 21 additions & 0 deletions include/cuco/detail/static_map/static_map_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,27 @@ static_map_ref<Key, T, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>
this->storage_ref()};
}

template <typename Key,
typename T,
cuda::thread_scope Scope,
typename KeyEqual,
typename ProbingScheme,
typename StorageRef,
typename... Operators>
template <typename NewKeyEqual>
__host__ __device__ constexpr auto
static_map_ref<Key, T, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept
{
return static_map_ref<Key, T, Scope, NewKeyEqual, ProbingScheme, StorageRef, Operators...>{
cuco::empty_key<Key>{this->empty_key_sentinel()},
cuco::empty_value<T>{this->empty_value_sentinel()},
key_equal,
this->probing_scheme(),
{},
this->storage_ref()};
}

template <typename Key,
typename T,
cuda::thread_scope Scope,
Expand Down
21 changes: 21 additions & 0 deletions include/cuco/detail/static_multimap/static_multimap_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,27 @@ __host__ __device__ auto constexpr static_multimap_ref<
impl_.storage_ref()};
}

template <typename Key,
typename T,
cuda::thread_scope Scope,
typename KeyEqual,
typename ProbingScheme,
typename StorageRef,
typename... Operators>
template <typename NewKeyEqual>
__host__ __device__ constexpr auto
static_multimap_ref<Key, T, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::
rebind_key_eq(NewKeyEqual const& key_equal) const noexcept
{
return static_multimap_ref<Key, T, Scope, NewKeyEqual, ProbingScheme, StorageRef, Operators...>{
cuco::empty_key<Key>{this->empty_key_sentinel()},
cuco::empty_value<T>{this->empty_value_sentinel()},
key_equal,
this->probing_scheme(),
{},
this->storage_ref()};
}

template <typename Key,
typename T,
cuda::thread_scope Scope,
Expand Down
11 changes: 6 additions & 5 deletions include/cuco/detail/static_multiset/static_multiset.inl
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>
ProbeHash const& probe_hash,
cuda::stream_ref stream) const
{
return impl_->count(first,
last,
ref(op::count).with_key_eq(probe_key_equal).rebind_hash_function(probe_hash),
stream);
return impl_->count(
first,
last,
ref(op::count).rebind_key_eq(probe_key_equal).rebind_hash_function(probe_hash),
stream);
}

template <class Key,
Expand All @@ -333,7 +334,7 @@ static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>
return impl_->count_outer(
first,
last,
ref(op::count).with_key_eq(probe_key_equal).rebind_hash_function(probe_hash),
ref(op::count).rebind_key_eq(probe_key_equal).rebind_hash_function(probe_hash),
stream);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ template <typename Key,
typename... Operators>
template <typename NewKeyEqual>
__host__ __device__ constexpr auto
static_multiset_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::with_key_eq(
static_multiset_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept
{
return static_multiset_ref<Key, Scope, NewKeyEqual, ProbingScheme, StorageRef, Operators...>{
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/detail/static_set/static_set_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ template <typename Key,
typename... Operators>
template <typename NewKeyEqual>
__host__ __device__ constexpr auto
static_set_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::with_key_eq(
static_set_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept
{
return static_set_ref<Key, Scope, NewKeyEqual, ProbingScheme, StorageRef, Operators...>{
Expand Down
13 changes: 13 additions & 0 deletions include/cuco/static_map_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,19 @@ class static_map_ref
[[nodiscard]] __host__ __device__ constexpr auto with_operators(
NewOperators... ops) const noexcept;

/**
* @brief Makes a copy of the current device reference with the given key comparator
*
* @tparam NewKeyEqual The new key equal type
*
* @param key_equal New key comparator
*
* @return Copy of the current device ref
*/
template <typename NewKeyEqual>
[[nodiscard]] __host__ __device__ constexpr auto rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept;

/**
* @brief Makes a copy of the current device reference with the given hasher
*
Expand Down
13 changes: 13 additions & 0 deletions include/cuco/static_multimap_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ class static_multimap_ref
[[nodiscard]] __host__ __device__ constexpr auto with_operators(
NewOperators... ops) const noexcept;

/**
* @brief Makes a copy of the current device reference with the given key comparator
*
* @tparam NewKeyEqual The new key equal type
*
* @param key_equal New key comparator
*
* @return Copy of the current device ref
*/
template <typename NewKeyEqual>
[[nodiscard]] __host__ __device__ constexpr auto rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept;

/**
* @brief Makes a copy of the current device reference with the given hasher
*
Expand Down
4 changes: 2 additions & 2 deletions include/cuco/static_multiset_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class static_multiset_ref
NewOperators... ops) const noexcept;

/**
* @brief Makes a copy of the current device reference with given key comparator
* @brief Makes a copy of the current device reference with the given key comparator
*
* @tparam NewKeyEqual The new key equal type
*
Expand All @@ -250,7 +250,7 @@ class static_multiset_ref
* @return Copy of the current device ref
*/
template <typename NewKeyEqual>
[[nodiscard]] __host__ __device__ constexpr auto with_key_eq(
[[nodiscard]] __host__ __device__ constexpr auto rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept;

/**
Expand Down
4 changes: 2 additions & 2 deletions include/cuco/static_set_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class static_set_ref
NewOperators... ops) const noexcept;

/**
* @brief Makes a copy of the current device reference with given key comparator
* @brief Makes a copy of the current device reference with the given key comparator
*
* @tparam NewKeyEqual The new key equal type
*
Expand All @@ -248,7 +248,7 @@ class static_set_ref
* @return Copy of the current device ref
*/
template <typename NewKeyEqual>
[[nodiscard]] __host__ __device__ constexpr auto with_key_eq(
[[nodiscard]] __host__ __device__ constexpr auto rebind_key_eq(
NewKeyEqual const& key_equal) const noexcept;

/**
Expand Down

0 comments on commit 75e1ac3

Please sign in to comment.