Skip to content

Commit ba70637

Browse files
committed
entity: handle conversion warnings
1 parent c2226ee commit ba70637

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/entt/entity/group.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class group_handler final: public group_descriptor {
131131

132132
void common_setup() {
133133
// we cannot iterate backwards because we want to leave behind valid entities in case of owned types
134-
for(auto first = pools[0u]->rbegin(), last = first + pools[0u]->size(); first != last; ++first) {
134+
for(auto first = pools[0u]->rbegin(), last = first + static_cast<typename decltype(pools)::difference_type>(pools[0u]->size()); first != last; ++first) {
135135
push_on_construct(*first);
136136
}
137137
}
@@ -465,7 +465,7 @@ class basic_group<owned_t<>, get_t<Get...>, exclude_t<Exclude...>> {
465465
* @return The identifier that occupies the given position.
466466
*/
467467
[[nodiscard]] entity_type operator[](const size_type pos) const {
468-
return begin()[pos];
468+
return begin()[static_cast<typename iterator::difference_type>(pos)];
469469
}
470470

471471
/**

src/entt/entity/sparse_set.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ class basic_sparse_set {
937937
}
938938
}
939939

940-
packed.erase(packed.begin() + from, packed.end());
940+
packed.erase(packed.begin() + static_cast<typename packed_container_type::difference_type>(from), packed.end());
941941
}
942942
}
943943

src/entt/entity/storage.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,8 @@ class basic_storage<Entity, Entity, Allocator>
12281228
/*! @copydoc each */
12291229
[[nodiscard]] const_iterable each() const noexcept {
12301230
const auto it = base_type::cend();
1231-
return const_iterable{it - base_type::free_list(), it};
1231+
const auto offset = static_cast<typename const_iterable::iterator::difference_type>(base_type::free_list());
1232+
return const_iterable{it - offset, it};
12321233
}
12331234

12341235
/**
@@ -1245,7 +1246,8 @@ class basic_storage<Entity, Entity, Allocator>
12451246
/*! @copydoc reach */
12461247
[[nodiscard]] const_reverse_iterable reach() const noexcept {
12471248
const auto it = base_type::crbegin();
1248-
return const_reverse_iterable{it, it + base_type::free_list()};
1249+
const auto offset = static_cast<typename const_reverse_iterable::iterator::difference_type>(base_type::free_list());
1250+
return const_reverse_iterable{it, it + offset};
12491251
}
12501252

12511253
private:

0 commit comments

Comments
 (0)