Skip to content

Commit 106af0f

Browse files
committed
container: cleanup
1 parent 3b71902 commit 106af0f

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/entt/container/dense_map.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,12 @@ class dense_map {
240240
using sparse_container_type = std::vector<std::size_t, typename alloc_traits::template rebind_alloc<std::size_t>>;
241241
using packed_container_type = std::vector<node_type, typename alloc_traits::template rebind_alloc<node_type>>;
242242

243-
template<typename Other>
244-
[[nodiscard]] std::size_t key_to_bucket(const Other &key) const noexcept {
243+
[[nodiscard]] std::size_t key_to_bucket(const auto &key) const noexcept {
245244
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
246245
return fast_mod(static_cast<size_type>(sparse.second()(key)), bucket_count());
247246
}
248247

249-
template<typename Other>
250-
[[nodiscard]] auto constrained_find(const Other &key, const std::size_t bucket) {
248+
[[nodiscard]] auto constrained_find(const auto &key, const std::size_t bucket) {
251249
for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].next) {
252250
if(packed.second()(packed.first()[offset].element.first, key)) {
253251
return begin() + static_cast<iterator::difference_type>(offset);
@@ -257,8 +255,7 @@ class dense_map {
257255
return end();
258256
}
259257

260-
template<typename Other>
261-
[[nodiscard]] auto constrained_find(const Other &key, const std::size_t bucket) const {
258+
[[nodiscard]] auto constrained_find(const auto &key, const std::size_t bucket) const {
262259
for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].next) {
263260
if(packed.second()(packed.first()[offset].element.first, key)) {
264261
return cbegin() + static_cast<const_iterator::difference_type>(offset);

src/entt/container/dense_set.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,11 @@ class dense_set {
203203
using sparse_container_type = std::vector<std::size_t, typename alloc_traits::template rebind_alloc<std::size_t>>;
204204
using packed_container_type = std::vector<node_type, typename alloc_traits::template rebind_alloc<node_type>>;
205205

206-
template<typename Other>
207-
[[nodiscard]] std::size_t value_to_bucket(const Other &value) const noexcept {
206+
[[nodiscard]] std::size_t value_to_bucket(const auto &value) const noexcept {
208207
return fast_mod(static_cast<size_type>(sparse.second()(value)), bucket_count());
209208
}
210209

211-
template<typename Other>
212-
[[nodiscard]] auto constrained_find(const Other &value, const std::size_t bucket) {
210+
[[nodiscard]] auto constrained_find(const auto &value, const std::size_t bucket) {
213211
for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].first) {
214212
if(packed.second()(packed.first()[offset].second, value)) {
215213
return begin() + static_cast<iterator::difference_type>(offset);
@@ -219,8 +217,7 @@ class dense_set {
219217
return end();
220218
}
221219

222-
template<typename Other>
223-
[[nodiscard]] auto constrained_find(const Other &value, const std::size_t bucket) const {
220+
[[nodiscard]] auto constrained_find(const auto &value, const std::size_t bucket) const {
224221
for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].first) {
225222
if(packed.second()(packed.first()[offset].second, value)) {
226223
return cbegin() + static_cast<const_iterator::difference_type>(offset);

0 commit comments

Comments
 (0)