diff --git a/include/cuco/detail/probing_scheme/probing_scheme_impl.inl b/include/cuco/detail/probing_scheme/probing_scheme_impl.inl index 047ec7987..ca39b2cb3 100644 --- a/include/cuco/detail/probing_scheme/probing_scheme_impl.inl +++ b/include/cuco/detail/probing_scheme/probing_scheme_impl.inl @@ -95,7 +95,7 @@ __host__ __device__ constexpr linear_probing::linear_probing(Hash template template -__host__ __device__ constexpr auto linear_probing::with_hash_function( +__host__ __device__ constexpr auto linear_probing::rebind_hash_function( NewHash const& hash) const noexcept { return linear_probing{hash}; @@ -143,28 +143,20 @@ __host__ __device__ constexpr double_hashing::double_hashi template __host__ __device__ constexpr double_hashing::double_hashing( - cuco::pair const& hash) + cuda::std::tuple const& hash) : hash1_{hash.first}, hash2_{hash.second} { } -template -template -__host__ __device__ constexpr auto double_hashing::with_hash_function( - NewHash1 const& hash1, NewHash2 const& hash2) const noexcept -{ - return double_hashing{hash1, hash2}; -} - template template -__host__ __device__ constexpr auto double_hashing::with_hash_function( +__host__ __device__ constexpr auto double_hashing::rebind_hash_function( NewHash const& hash) const { static_assert(cuco::is_tuple_like::value, "The given hasher must be a tuple-like object"); - auto const [hash1, hash2] = cuco::pair{hash}; + auto const [hash1, hash2] = cuda::std::tuple{hash}; using hash1_type = cuda::std::decay_t; using hash2_type = cuda::std::decay_t; return double_hashing{hash1, hash2}; diff --git a/include/cuco/detail/static_map/kernels.cuh b/include/cuco/detail/static_map/kernels.cuh index bf2aced70..4e4f396db 100644 --- a/include/cuco/detail/static_map/kernels.cuh +++ b/include/cuco/detail/static_map/kernels.cuh @@ -206,7 +206,7 @@ CUCO_KERNEL __launch_bounds__(BlockSize) void insert_or_apply_shmem( ref.probing_scheme(), {}, storage}; - auto shared_map_ref = std::move(shared_map).with(cuco::op::insert_or_apply); + auto shared_map_ref = shared_map.rebind_operators(cuco::op::insert_or_apply); shared_map_ref.initialize(block); block.sync(); @@ -262,4 +262,4 @@ CUCO_KERNEL __launch_bounds__(BlockSize) void insert_or_apply_shmem( } } } -} // namespace cuco::static_map_ns::detail \ No newline at end of file +} // namespace cuco::static_map_ns::detail diff --git a/include/cuco/detail/static_map/static_map_ref.inl b/include/cuco/detail/static_map/static_map_ref.inl index 3756a641b..989880904 100644 --- a/include/cuco/detail/static_map/static_map_ref.inl +++ b/include/cuco/detail/static_map/static_map_ref.inl @@ -296,11 +296,17 @@ template template -auto static_map_ref::with( - NewOperators...) && noexcept +__host__ __device__ constexpr auto +static_map_ref::with_operators( + NewOperators...) const noexcept { return static_map_ref{ - std::move(*this)}; + cuco::empty_key{this->empty_key_sentinel()}, + cuco::empty_value{this->empty_value_sentinel()}, + this->key_eq(), + this->probing_scheme(), + {}, + this->storage_ref()}; } template template -__host__ __device__ auto constexpr static_map_ref::with_operators(NewOperators...) - const noexcept +__host__ __device__ constexpr auto +static_map_ref::rebind_operators( + NewOperators...) const noexcept { return static_map_ref{ cuco::empty_key{this->empty_key_sentinel()}, cuco::empty_value{this->empty_value_sentinel()}, this->key_eq(), - this->impl_.probing_scheme(), + this->probing_scheme(), {}, - this->impl_.storage_ref()}; + this->storage_ref()}; +} + +template +template +__host__ __device__ constexpr auto +static_map_ref::rebind_key_eq( + NewKeyEqual const& key_equal) const noexcept +{ + return static_map_ref{ + cuco::empty_key{this->empty_key_sentinel()}, + cuco::empty_value{this->empty_value_sentinel()}, + key_equal, + this->probing_scheme(), + {}, + this->storage_ref()}; +} + +template +template +__host__ __device__ constexpr auto +static_map_ref:: + rebind_hash_function(NewHash const& hash) const +{ + auto const probing_scheme = this->probing_scheme().rebind_hash_function(hash); + return static_map_ref, + StorageRef, + Operators...>{cuco::empty_key{this->empty_key_sentinel()}, + cuco::empty_value{this->empty_value_sentinel()}, + this->key_eq(), + probing_scheme, + {}, + this->storage_ref()}; } template cuco::empty_value{this->empty_value_sentinel()}, cuco::erased_key{this->erased_key_sentinel()}, this->key_eq(), - this->impl_.probing_scheme(), + this->probing_scheme(), scope, storage_ref_type{this->window_extent(), memory_to_use}}; } diff --git a/include/cuco/detail/static_multimap/static_multimap_ref.inl b/include/cuco/detail/static_multimap/static_multimap_ref.inl index 6a66eafca..bfceb75b6 100644 --- a/include/cuco/detail/static_multimap/static_multimap_ref.inl +++ b/include/cuco/detail/static_multimap/static_multimap_ref.inl @@ -295,11 +295,22 @@ template template -auto static_multimap_ref::with( - NewOperators...) && noexcept +__host__ __device__ auto constexpr static_multimap_ref< + Key, + T, + Scope, + KeyEqual, + ProbingScheme, + StorageRef, + Operators...>::with_operators(NewOperators...) const noexcept { return static_multimap_ref{ - std::move(*this)}; + cuco::empty_key{this->empty_key_sentinel()}, + cuco::empty_value{this->empty_value_sentinel()}, + this->key_eq(), + this->probing_scheme(), + {}, + impl_.storage_ref()}; } template ::with_operators(NewOperators...) const noexcept + Operators...>::rebind_operators(NewOperators...) const noexcept { return static_multimap_ref{ cuco::empty_key{this->empty_key_sentinel()}, @@ -325,7 +336,55 @@ __host__ __device__ auto constexpr static_multimap_ref< this->key_eq(), impl_.probing_scheme(), {}, - impl_.storage_ref()}; + this->storage_ref()}; +} + +template +template +__host__ __device__ constexpr auto +static_multimap_ref:: + rebind_key_eq(NewKeyEqual const& key_equal) const noexcept +{ + return static_multimap_ref{ + cuco::empty_key{this->empty_key_sentinel()}, + cuco::empty_value{this->empty_value_sentinel()}, + key_equal, + this->probing_scheme(), + {}, + this->storage_ref()}; +} + +template +template +__host__ __device__ constexpr auto +static_multimap_ref:: + rebind_hash_function(NewHash const& hash) const +{ + auto const probing_scheme = this->probing_scheme().rebind_hash_function(hash); + return static_multimap_ref, + StorageRef, + Operators...>{cuco::empty_key{this->empty_key_sentinel()}, + cuco::empty_value{this->empty_value_sentinel()}, + this->key_eq(), + probing_scheme, + {}, + this->storage_ref()}; } template ProbeHash const& probe_hash, cuda::stream_ref stream) const { - return impl_->count(first, - last, - ref(op::count).with_key_eq(probe_key_equal).with_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 return impl_->count_outer( first, last, - ref(op::count).with_key_eq(probe_key_equal).with_hash_function(probe_hash), + ref(op::count).rebind_key_eq(probe_key_equal).rebind_hash_function(probe_hash), stream); } diff --git a/include/cuco/detail/static_multiset/static_multiset_ref.inl b/include/cuco/detail/static_multiset/static_multiset_ref.inl index aa25cdf70..1cc212f14 100644 --- a/include/cuco/detail/static_multiset/static_multiset_ref.inl +++ b/include/cuco/detail/static_multiset/static_multiset_ref.inl @@ -251,11 +251,16 @@ template template -auto static_multiset_ref::with( - NewOperators...) && noexcept +__host__ __device__ constexpr auto +static_multiset_ref::with_operators( + NewOperators...) const noexcept { return static_multiset_ref{ - std::move(*this)}; + cuco::empty_key{this->empty_key_sentinel()}, + this->key_eq(), + this->probing_scheme(), + {}, + this->storage_ref()}; } template template __host__ __device__ constexpr auto -static_multiset_ref::with_operators( - NewOperators...) const noexcept +static_multiset_ref:: + rebind_operators(NewOperators...) const noexcept { return static_multiset_ref{ cuco::empty_key{this->empty_key_sentinel()}, this->key_eq(), - this->impl_.probing_scheme(), + this->probing_scheme(), {}, - this->impl_.storage_ref()}; + this->storage_ref()}; } template template __host__ __device__ constexpr auto -static_multiset_ref::with_key_eq( +static_multiset_ref::rebind_key_eq( NewKeyEqual const& key_equal) const noexcept { return static_multiset_ref{ cuco::empty_key{this->empty_key_sentinel()}, key_equal, - this->impl_.probing_scheme(), + this->probing_scheme(), {}, - this->impl_.storage_ref()}; + this->storage_ref()}; } template __host__ __device__ constexpr auto static_multiset_ref:: - with_hash_function(NewHash const& hash) const + rebind_hash_function(NewHash const& hash) const { - auto const probing_scheme = this->impl_.probing_scheme().with_hash_function(hash); + auto const probing_scheme = this->probing_scheme().rebind_hash_function(hash); return static_multiset_ref, StorageRef, Operators...>{cuco::empty_key{this->empty_key_sentinel()}, - this->impl_.key_eq(), + this->key_eq(), probing_scheme, {}, - this->impl_.storage_ref()}; + this->storage_ref()}; } namespace detail { diff --git a/include/cuco/detail/static_set/static_set_ref.inl b/include/cuco/detail/static_set/static_set_ref.inl index 7e2882a0a..a70df3d76 100644 --- a/include/cuco/detail/static_set/static_set_ref.inl +++ b/include/cuco/detail/static_set/static_set_ref.inl @@ -248,11 +248,16 @@ template template -auto static_set_ref::with( - NewOperators...) && noexcept +__host__ __device__ constexpr auto +static_set_ref::with_operators( + NewOperators...) const noexcept { return static_set_ref{ - std::move(*this)}; + cuco::empty_key{this->empty_key_sentinel()}, + this->key_eq(), + this->probing_scheme(), + {}, + this->storage_ref()}; } template template __host__ __device__ constexpr auto -static_set_ref::with_operators( +static_set_ref::rebind_operators( NewOperators...) const noexcept { return static_set_ref{ cuco::empty_key{this->empty_key_sentinel()}, this->key_eq(), - this->impl_.probing_scheme(), + this->probing_scheme(), {}, - this->impl_.storage_ref()}; + this->storage_ref()}; } template template __host__ __device__ constexpr auto -static_set_ref::with_key_eq( +static_set_ref::rebind_key_eq( NewKeyEqual const& key_equal) const noexcept { return static_set_ref{ cuco::empty_key{this->empty_key_sentinel()}, key_equal, - this->impl_.probing_scheme(), + this->probing_scheme(), {}, - this->impl_.storage_ref()}; + this->storage_ref()}; } template template __host__ __device__ constexpr auto -static_set_ref::with_hash_function( +static_set_ref::rebind_hash_function( NewHash const& hash) const { - auto const probing_scheme = this->impl_.probing_scheme().with_hash_function(hash); + auto const probing_scheme = this->probing_scheme().rebind_hash_function(hash); return static_set_ref, StorageRef, Operators...>{cuco::empty_key{this->empty_key_sentinel()}, - this->impl_.key_eq(), + this->key_eq(), probing_scheme, {}, - this->impl_.storage_ref()}; + this->storage_ref()}; } template ::m cuco::empty_key{this->empty_key_sentinel()}, cuco::erased_key{this->erased_key_sentinel()}, this->key_eq(), - this->impl_.probing_scheme(), + this->probing_scheme(), scope, storage_ref_type{this->window_extent(), memory_to_use}}; } diff --git a/include/cuco/probing_scheme.cuh b/include/cuco/probing_scheme.cuh index 4885ad63d..4032daadb 100644 --- a/include/cuco/probing_scheme.cuh +++ b/include/cuco/probing_scheme.cuh @@ -62,7 +62,7 @@ class linear_probing : private detail::probing_scheme_base { * @return Copy of the current probing method */ template - [[nodiscard]] __host__ __device__ constexpr auto with_hash_function( + [[nodiscard]] __host__ __device__ constexpr auto rebind_hash_function( NewHash const& hash) const noexcept; /** @@ -143,23 +143,7 @@ class double_hashing : private detail::probing_scheme_base { * * @param hash Hasher tuple */ - __host__ __device__ constexpr double_hashing(cuco::pair const& hash); - - /** - *@brief Makes a copy of the current probing method with the given hasher - * - * @tparam NewHash1 First new hasher type - * @tparam NewHash2 Second new hasher type - * - * @param hash1 First hasher - * @param hash2 second hasher - * - * @return Copy of the current probing method - */ - template - [[nodiscard]] __host__ __device__ constexpr auto with_hash_function(NewHash1 const& hash1, - NewHash2 const& hash2 = { - 1}) const noexcept; + __host__ __device__ constexpr double_hashing(cuda::std::tuple const& hash); /** *@brief Makes a copy of the current probing method with the given hasher @@ -174,7 +158,7 @@ class double_hashing : private detail::probing_scheme_base { */ template ::value>> - [[nodiscard]] __host__ __device__ constexpr auto with_hash_function(NewHash const& hash) const; + [[nodiscard]] __host__ __device__ constexpr auto rebind_hash_function(NewHash const& hash) const; /** * @brief Operator to return a probing iterator diff --git a/include/cuco/static_map_ref.cuh b/include/cuco/static_map_ref.cuh index 1da1e501a..e3399a93e 100644 --- a/include/cuco/static_map_ref.cuh +++ b/include/cuco/static_map_ref.cuh @@ -227,11 +227,7 @@ class static_map_ref [[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept; /** - * @brief Creates a reference with new operators from the current object. - * - * @deprecated This function is deprecated. Use the new `with_operators` instead. - * - * Note that this function uses move semantics and thus invalidates the current object. + * @brief Creates a reference with new operators from the current object * * @warning Using two or more reference objects to the same container but with * a different operator set at the same time results in undefined behavior. @@ -243,24 +239,47 @@ class static_map_ref * @return `*this` with `NewOperators...` */ template - [[nodiscard]] __host__ __device__ auto with(NewOperators... ops) && noexcept; + [[nodiscard]] __host__ __device__ constexpr auto with_operators( + NewOperators... ops) const noexcept; /** - * @brief Creates a reference with new operators from the current object - * - * @warning Using two or more reference objects to the same container but with - * a different operator set at the same time results in undefined behavior. + * @brief Creates a copy of the current non-owning reference using the given operators * * @tparam NewOperators List of `cuco::op::*_tag` types * - * @param ops List of operators, e.g., `cuco::insert` + * @param ops List of operators, e.g., `cuco::op::insert` * - * @return `*this` with `NewOperators...` + * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_operators( + [[nodiscard]] __host__ __device__ constexpr auto rebind_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 + [[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 + * + * @tparam NewHash The new hasher type + * + * @param hash New hasher + * + * @return Copy of the current device ref + */ + template + [[nodiscard]] __host__ __device__ constexpr auto rebind_hash_function(NewHash const& hash) const; + /** * @brief Makes a copy of the current device reference using non-owned memory * diff --git a/include/cuco/static_multimap_ref.cuh b/include/cuco/static_multimap_ref.cuh index b23925b86..ddcf77dba 100644 --- a/include/cuco/static_multimap_ref.cuh +++ b/include/cuco/static_multimap_ref.cuh @@ -226,11 +226,7 @@ class static_multimap_ref [[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept; /** - * @brief Creates a reference with new operators from the current object. - * - * @deprecated This function is deprecated. Use the new `with_operators` instead. - * - * Note that this function uses move semantics and thus invalidates the current object. + * @brief Creates a reference with new operators from the current object * * @warning Using two or more reference objects to the same container but with * a different operator set at the same time results in undefined behavior. @@ -242,24 +238,47 @@ class static_multimap_ref * @return `*this` with `NewOperators...` */ template - [[nodiscard]] __host__ __device__ auto with(NewOperators... ops) && noexcept; + [[nodiscard]] __host__ __device__ constexpr auto with_operators( + NewOperators... ops) const noexcept; /** - * @brief Creates a reference with new operators from the current object - * - * @warning Using two or more reference objects to the same container but with - * a different operator set at the same time results in undefined behavior. + * @brief Creates a copy of the current non-owning reference using the given operators * * @tparam NewOperators List of `cuco::op::*_tag` types * - * @param ops List of operators, e.g., `cuco::insert` + * @param ops List of operators, e.g., `cuco::op::insert` * - * @return `*this` with `NewOperators...` + * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_operators( + [[nodiscard]] __host__ __device__ constexpr auto rebind_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 + [[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 + * + * @tparam NewHash The new hasher type + * + * @param hash New hasher + * + * @return Copy of the current device ref + */ + template + [[nodiscard]] __host__ __device__ constexpr auto rebind_hash_function(NewHash const& hash) const; + /** * @brief Makes a copy of the current device reference using non-owned memory * diff --git a/include/cuco/static_multiset_ref.cuh b/include/cuco/static_multiset_ref.cuh index bf0588f2f..25c98b874 100644 --- a/include/cuco/static_multiset_ref.cuh +++ b/include/cuco/static_multiset_ref.cuh @@ -206,11 +206,7 @@ class static_multiset_ref [[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept; /** - * @brief Creates a reference with new operators from the current object. - * - * @deprecated This function is deprecated. Use the new `with_operators` instead. - * - * Note that this function uses move semantics and thus invalidates the current object. + * @brief Creates a reference with new operators from the current object * * @warning Using two or more reference objects to the same container but with * a different operator set at the same time results in undefined behavior. @@ -222,26 +218,24 @@ class static_multiset_ref * @return `*this` with `NewOperators...` */ template - [[nodiscard]] __host__ __device__ auto with(NewOperators... ops) && noexcept; + [[nodiscard]] __host__ __device__ constexpr auto with_operators( + NewOperators... ops) const noexcept; /** - * @brief Creates a reference with new operators from the current object - * - * @warning Using two or more reference objects to the same container but with - * a different operator set at the same time results in undefined behavior. + * @brief Creates a copy of the current non-owning reference using the given operators * * @tparam NewOperators List of `cuco::op::*_tag` types * - * @param ops List of operators, e.g., `cuco::insert` + * @param ops List of operators, e.g., `cuco::op::insert` * - * @return `*this` with `NewOperators...` + * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_operators( + [[nodiscard]] __host__ __device__ constexpr auto rebind_operators( 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 * @@ -250,11 +244,11 @@ class static_multiset_ref * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_key_eq( + [[nodiscard]] __host__ __device__ constexpr auto rebind_key_eq( NewKeyEqual const& key_equal) const noexcept; /** - * @brief Makes a copy of the current device reference with given hasher + * @brief Makes a copy of the current device reference with the given hasher * * @tparam NewHash The new hasher type * @@ -263,7 +257,7 @@ class static_multiset_ref * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_hash_function(NewHash const& hash) const; + [[nodiscard]] __host__ __device__ constexpr auto rebind_hash_function(NewHash const& hash) const; private: impl_type impl_; diff --git a/include/cuco/static_set_ref.cuh b/include/cuco/static_set_ref.cuh index 1271cb756..fa0098ebf 100644 --- a/include/cuco/static_set_ref.cuh +++ b/include/cuco/static_set_ref.cuh @@ -204,11 +204,7 @@ class static_set_ref [[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept; /** - * @brief Creates a reference with new operators from the current object. - * - * @deprecated This function is deprecated. Use the new `with_operators` instead. - * - * Note that this function uses move semantics and thus invalidates the current object. + * @brief Creates a reference with new operators from the current object * * @warning Using two or more reference objects to the same container but with * a different operator set at the same time results in undefined behavior. @@ -220,26 +216,24 @@ class static_set_ref * @return `*this` with `NewOperators...` */ template - [[nodiscard]] __host__ __device__ auto with(NewOperators... ops) && noexcept; + [[nodiscard]] __host__ __device__ constexpr auto with_operators( + NewOperators... ops) const noexcept; /** - * @brief Creates a reference with new operators from the current object - * - * @warning Using two or more reference objects to the same container but with - * a different operator set at the same time results in undefined behavior. + * @brief Creates a copy of the current non-owning reference using the given operators * * @tparam NewOperators List of `cuco::op::*_tag` types * - * @param ops List of operators, e.g., `cuco::insert` + * @param ops List of operators, e.g., `cuco::op::insert` * - * @return `*this` with `NewOperators...` + * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_operators( + [[nodiscard]] __host__ __device__ constexpr auto rebind_operators( 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 * @@ -248,11 +242,11 @@ class static_set_ref * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_key_eq( + [[nodiscard]] __host__ __device__ constexpr auto rebind_key_eq( NewKeyEqual const& key_equal) const noexcept; /** - * @brief Makes a copy of the current device reference with given hasher + * @brief Makes a copy of the current device reference with the given hasher * * @tparam NewHash The new hasher type * @@ -261,7 +255,7 @@ class static_set_ref * @return Copy of the current device ref */ template - [[nodiscard]] __host__ __device__ constexpr auto with_hash_function(NewHash const& hash) const; + [[nodiscard]] __host__ __device__ constexpr auto rebind_hash_function(NewHash const& hash) const; /** * @brief Makes a copy of the current device reference using non-owned memory diff --git a/tests/static_multiset/custom_count_test.cu b/tests/static_multiset/custom_count_test.cu index f92b91aad..f5ade5eeb 100644 --- a/tests/static_multiset/custom_count_test.cu +++ b/tests/static_multiset/custom_count_test.cu @@ -61,21 +61,27 @@ void test_custom_count(Set& set, size_type num_keys) { using Key = typename Set::key_type; + auto const hash = []() { + if constexpr (cuco::is_double_hashing::value) { + return cuda::std::tuple{custom_hash{}, custom_hash{}}; + } else { + return custom_hash{}; + } + }(); + auto query_begin = thrust::make_transform_iterator( thrust::make_counting_iterator(0), cuda::proclaim_return_type([] __device__(auto i) { return static_cast(i * XXX); })); SECTION("Count of empty set should be zero.") { - auto const count = - set.count(query_begin, query_begin + num_keys, custom_key_eq{}, custom_hash{}); + auto const count = set.count(query_begin, query_begin + num_keys, custom_key_eq{}, hash); REQUIRE(count == 0); } SECTION("Outer count of empty set should be the same as input size.") { - auto const count = - set.count_outer(query_begin, query_begin + num_keys, custom_key_eq{}, custom_hash{}); + auto const count = set.count_outer(query_begin, query_begin + num_keys, custom_key_eq{}, hash); REQUIRE(count == num_keys); } @@ -84,15 +90,13 @@ void test_custom_count(Set& set, size_type num_keys) SECTION("Count of n unique keys should be n.") { - auto const count = - set.count(query_begin, query_begin + num_keys, custom_key_eq{}, custom_hash{}); + auto const count = set.count(query_begin, query_begin + num_keys, custom_key_eq{}, hash); REQUIRE(count == num_keys); } SECTION("Outer count of n unique keys should be n.") { - auto const count = - set.count_outer(query_begin, query_begin + num_keys, custom_key_eq{}, custom_hash{}); + auto const count = set.count_outer(query_begin, query_begin + num_keys, custom_key_eq{}, hash); REQUIRE(count == num_keys); } @@ -102,15 +106,13 @@ void test_custom_count(Set& set, size_type num_keys) SECTION("Count of a key whose multiplicity equals n should be n.") { - auto const count = - set.count(query_begin, query_begin + num_keys, custom_key_eq{}, custom_hash{}); + auto const count = set.count(query_begin, query_begin + num_keys, custom_key_eq{}, hash); REQUIRE(count == num_keys); } SECTION("Outer count of a key whose multiplicity equals n should be n + input_size - 1.") { - auto const count = - set.count_outer(query_begin, query_begin + num_keys, custom_key_eq{}, custom_hash{}); + auto const count = set.count_outer(query_begin, query_begin + num_keys, custom_key_eq{}, hash); REQUIRE(count == 2 * num_keys - 1); } }