stl: std::distance

This commit is contained in:
skypjack
2026-03-31 08:56:56 +02:00
parent be840ee569
commit fc9eb2a9f2
6 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -915,7 +915,7 @@ public:
* @return The number of elements in the given bucket.
*/
[[nodiscard]] size_type bucket_size(const size_type index) const {
return static_cast<size_type>(std::distance(begin(index), end(index)));
return static_cast<size_type>(stl::distance(begin(index), end(index)));
}
/**
+1 -1
View File
@@ -791,7 +791,7 @@ public:
* @return The number of elements in the given bucket.
*/
[[nodiscard]] size_type bucket_size(const size_type index) const {
return static_cast<size_type>(std::distance(begin(index), end(index)));
return static_cast<size_type>(stl::distance(begin(index), end(index)));
}
/**
+1 -1
View File
@@ -99,7 +99,7 @@ struct radix_sort {
using value_type = std::iterator_traits<It>::value_type;
using difference_type = std::iterator_traits<It>::difference_type;
stl::vector<value_type> aux(static_cast<std::size_t>(std::distance(first, last)));
stl::vector<value_type> aux(static_cast<std::size_t>(stl::distance(first, last)));
auto part = [getter = std::move(getter)](auto from, auto to, auto out, auto start) {
constexpr auto mask = (1 << Bit) - 1;
+1 -1
View File
@@ -138,7 +138,7 @@ public:
static_assert(!std::is_same_v<Type, entity_type>, "Entity types not supported");
if(const auto *storage = reg->template storage<Type>(id); storage && !storage->empty()) {
archive(static_cast<traits_type::entity_type>(std::distance(first, last)));
archive(static_cast<traits_type::entity_type>(stl::distance(first, last)));
for(; first != last; ++first) {
if(const auto entt = *first; storage->contains(entt)) {
+1 -1
View File
@@ -873,7 +873,7 @@ public:
++first;
}
count += static_cast<size_type>(std::distance(it, first));
count += static_cast<size_type>(stl::distance(it, first));
erase(it, first);
}
} else {
+3 -1
View File
@@ -10,9 +10,11 @@ namespace entt::stl {
using std::bidirectional_iterator_tag;
using std::forward_iterator_tag;
using std::input_iterator_tag;
using std::make_reverse_iterator;
using std::random_access_iterator_tag;
using std::distance;
using std::make_reverse_iterator;
#ifndef ENTT_FORCE_STL
# if __has_include(<version>)
# include <version>