From 798d5eeb86b353bebe71f39cc0593cb9c5e3808a Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 29 Aug 2022 12:04:35 +0200 Subject: [PATCH] storage: minor changes (help the code coverage tool) --- src/entt/entity/storage.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index aebd59ae7..b214411ba 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -16,8 +16,8 @@ #include "component.hpp" #include "entity.hpp" #include "fwd.hpp" -#include "storage_mixin.hpp" #include "sparse_set.hpp" +#include "storage_mixin.hpp" namespace entt { @@ -310,18 +310,18 @@ private: } void swap_at([[maybe_unused]] const std::size_t lhs, [[maybe_unused]] const std::size_t rhs) final { - if constexpr(is_pinned_type_v) { - ENTT_ASSERT(false, "Pinned type"); - } else { + ENTT_ASSERT(!is_pinned_type_v, "Pinned type"); + + if constexpr(!is_pinned_type_v) { using std::swap; swap(element_at(lhs), element_at(rhs)); } } void move_element([[maybe_unused]] const std::size_t from, [[maybe_unused]] const std::size_t to) final { - if constexpr(is_pinned_type_v) { - ENTT_ASSERT(false, "Pinned type"); - } else { + ENTT_ASSERT(!is_pinned_type_v, "Pinned type"); + + if constexpr(!is_pinned_type_v) { auto &elem = element_at(from); entt::uninitialized_construct_using_allocator(to_address(assure_at_least(to)), packed.second(), std::move(elem)); std::destroy_at(std::addressof(elem));