sparse_set: use scoped iterators within ::sort

This commit is contained in:
Michele Caini
2023-10-24 11:11:11 +02:00
parent 8d92440451
commit 1f7f613800
2 changed files with 4 additions and 4 deletions

View File

@@ -1040,7 +1040,7 @@ public:
*/
template<typename Compare, typename Sort = std_sort, typename... Args>
void sort(Compare compare, Sort algo = Sort{}, Args &&...args) {
sort_n(packed.size(), std::move(compare), std::move(algo), std::forward<Args>(args)...);
sort_n(static_cast<size_type>(end(0) - begin(0)), std::move(compare), std::move(algo), std::forward<Args>(args)...);
}
/**

View File

@@ -1745,11 +1745,11 @@ ENTT_DEBUG_TYPED_TEST(SparseSetDeathTest, Sort) {
set.erase(entity);
switch(policy) {
case entt::deletion_policy::swap_and_pop: {
case entt::deletion_policy::swap_and_pop:
case entt::deletion_policy::swap_only: {
SUCCEED();
} break;
case entt::deletion_policy::in_place:
case entt::deletion_policy::swap_only: {
case entt::deletion_policy::in_place: {
ASSERT_DEATH(set.sort(std::less{});, "");
} break;
}