diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index d057fcc5f..856506422 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -154,7 +154,7 @@ public: size_type cnt = 0u; for(auto pos = 0u; pos < length; ++pos) { - cnt += ((elem[pos] == entt::type_hash::value()) || ...); + cnt += ((elem[pos] == entt::type_hash::value()) || ...); } return cnt; @@ -284,7 +284,7 @@ class basic_group, get_t, exclude_t> { using underlying_type = typename base_type::entity_type; template - static constexpr std::size_t index_of = type_list_index_v, type_list>; + static constexpr std::size_t index_of = type_list_index_v, type_list>; auto pools() const noexcept { using return_type = std::tuple; @@ -697,7 +697,7 @@ class basic_group, get_t, exclude_t> { using underlying_type = typename base_type::entity_type; template - static constexpr std::size_t index_of = type_list_index_v, type_list>; + static constexpr std::size_t index_of = type_list_index_v, type_list>; auto pools() const noexcept { using return_type = std::tuple; diff --git a/src/entt/entity/helper.hpp b/src/entt/entity/helper.hpp index ae21cd9f4..fef2bb451 100644 --- a/src/entt/entity/helper.hpp +++ b/src/entt/entity/helper.hpp @@ -22,7 +22,7 @@ template class as_view { template auto dispatch(get_t, exclude_t) const { - return reg.template view...>(exclude_t...>{}); + return reg.template view...>(exclude_t...>{}); } public: @@ -62,9 +62,9 @@ class as_group { template auto dispatch(owned_t, get_t, exclude_t) const { if constexpr(std::is_const_v) { - return reg.template group_if_exists(get_t{}, exclude_t{}); + return reg.template group_if_exists(get_t{}, exclude_t{}); } else { - return reg.template group...>(get_t...>{}, exclude_t...>{}); + return reg.template group...>(get_t...>{}, exclude_t...>{}); } } @@ -125,7 +125,7 @@ void invoke(Registry ®, const typename Registry::entity_type entt) { * @return The entity associated with the given component. */ template -auto to_entity(const basic_storage &storage, const typename basic_storage::value_type &instance) -> typename basic_storage::entity_type { +typename basic_storage::entity_type to_entity(const basic_storage &storage, const typename basic_storage::value_type &instance) { constexpr auto page_size = basic_storage::traits_type::page_size; const typename basic_storage::base_type &base = storage; const auto *addr = std::addressof(instance); diff --git a/src/entt/entity/mixin.hpp b/src/entt/entity/mixin.hpp index 67802b95e..e858116d6 100644 --- a/src/entt/entity/mixin.hpp +++ b/src/entt/entity/mixin.hpp @@ -57,7 +57,7 @@ class basic_sigh_mixin final: public Type { void pop_all() final { if(auto ® = owner_or_assert(); !destruction.empty()) { for(auto it = underlying_type::base_type::begin(0), last = underlying_type::base_type::end(0); it != last; ++it) { - if constexpr(std::is_same_v) { + if constexpr(std::is_same_v) { destruction.publish(reg, *it); } else { if constexpr(underlying_type::traits_type::in_place_delete) { @@ -231,7 +231,7 @@ public: */ template decltype(auto) emplace(const entity_type hint, Args &&...args) { - if constexpr(std::is_same_v) { + if constexpr(std::is_same_v) { const auto entt = underlying_type::emplace(hint, std::forward(args)...); construction.publish(owner_or_assert(), entt); return entt; diff --git a/src/entt/entity/observer.hpp b/src/entt/entity/observer.hpp index d9f53e03b..d38663e33 100644 --- a/src/entt/entity/observer.hpp +++ b/src/entt/entity/observer.hpp @@ -256,7 +256,7 @@ class basic_observer: private basic_storage void connect(Registry ®, std::index_sequence) { - static_assert(sizeof...(Matcher) < std::numeric_limits::digits, "Too many matchers"); + static_assert(sizeof...(Matcher) < std::numeric_limits::digits, "Too many matchers"); (matcher_handler::template connect(*this, reg), ...); release.template connect<&basic_observer::disconnect>(reg); } diff --git a/src/entt/entity/organizer.hpp b/src/entt/entity/organizer.hpp index 31c747ce4..ab677509f 100644 --- a/src/entt/entity/organizer.hpp +++ b/src/entt/entity/organizer.hpp @@ -52,8 +52,8 @@ struct unpack_type, type_list> template struct unpack_type, exclude_t>, type_list> { - using ro = type_list_cat_t, typename unpack_type, type_list>::ro...>; - using rw = type_list_cat_t, type_list>::rw...>; + using ro = type_list_cat_t, typename unpack_type, type_list>::ro...>; + using rw = type_list_cat_t, type_list>::rw...>; }; template diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index a2e89a873..c5eb3ed29 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -375,13 +375,13 @@ protected: */ underlying_iterator try_emplace([[maybe_unused]] const Entity entt, [[maybe_unused]] const bool force_back, const void *value) override { if(value) { - if constexpr(std::is_copy_constructible_v) { - return emplace_element(entt, force_back, *static_cast(value)); + if constexpr(std::is_copy_constructible_v) { + return emplace_element(entt, force_back, *static_cast(value)); } else { return base_type::end(); } } else { - if constexpr(std::is_default_constructible_v) { + if constexpr(std::is_default_constructible_v) { return emplace_element(entt, force_back); } else { return base_type::end(); @@ -392,10 +392,12 @@ protected: public: /*! @brief Base type. */ using base_type = underlying_type; + /*! @brief Element type. */ + using element_type = Type; /*! @brief Type of the objects assigned to entities. */ - using value_type = Type; + using value_type = element_type; /*! @brief Component traits. */ - using traits_type = component_traits; + using traits_type = component_traits; /*! @brief Underlying entity identifier. */ using entity_type = Entity; /*! @brief Unsigned integer type. */ @@ -432,7 +434,7 @@ public: * @param allocator The allocator to use. */ explicit basic_storage(const allocator_type &allocator) - : base_type{type_id(), deletion_policy{traits_type::in_place_delete}, allocator}, + : base_type{type_id(), deletion_policy{traits_type::in_place_delete}, allocator}, payload{allocator} {} /** @@ -779,10 +781,10 @@ class basic_storage>; + /*! @brief Element type. */ + using element_type = Type; /*! @brief Type of the objects assigned to entities. */ - using value_type = Type; - /*! @brief Component traits. */ - using traits_type = component_traits; + using value_type = element_type; /*! @brief Underlying entity identifier. */ using entity_type = Entity; /*! @brief Unsigned integer type. */ @@ -807,7 +809,7 @@ public: * @param allocator The allocator to use. */ explicit basic_storage(const allocator_type &allocator) - : base_type{type_id(), deletion_policy{traits_type::in_place_delete}, allocator} {} + : base_type{type_id(), deletion_policy{traits_type::in_place_delete}, allocator} {} /** * @brief Move constructor. @@ -836,7 +838,7 @@ public: */ [[nodiscard]] constexpr allocator_type get_allocator() const noexcept { // std::allocator has no cross constructors (waiting for C++20) - if constexpr(std::is_void_v && !std::is_constructible_v) { + if constexpr(std::is_void_v && !std::is_constructible_v) { return allocator_type{}; } else { return allocator_type{base_type::get_allocator()}; @@ -983,8 +985,8 @@ protected: public: /*! @brief Base type. */ using base_type = basic_sparse_set; - /*! @brief Type of the objects assigned to entities. */ - using value_type = Entity; + /*! @brief Element type. */ + using element_type = Entity; /*! @brief Underlying entity identifier. */ using entity_type = Entity; /*! @brief Unsigned integer type. */ diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index e3236be79..a3cea6632 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -377,7 +377,7 @@ class basic_view, exclude_t>: public basic_common_view using base_type = basic_common_view, sizeof...(Get), sizeof...(Exclude)>; template - static constexpr std::size_t index_of = type_list_index_v, type_list>; + static constexpr std::size_t index_of = type_list_index_v, type_list>; template auto get(const typename base_type::entity_type entt, std::index_sequence) const noexcept { @@ -495,7 +495,7 @@ public: */ template void storage(Type &elem) noexcept { - storage>(elem); + storage>(elem); } /** @@ -797,9 +797,9 @@ public: * @tparam Type Type of component of which to return the storage. * @return The storage for the given component type. */ - template + template [[nodiscard]] auto *storage() const noexcept { - static_assert(std::is_same_v, typename Get::value_type>, "Invalid component type"); + static_assert(std::is_same_v, typename Get::element_type>, "Invalid component type"); return storage<0>(); } @@ -850,7 +850,7 @@ public: */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { - static_assert(std::is_same_v, typename Get::value_type>, "Invalid component type"); + static_assert(std::is_same_v, typename Get::element_type>, "Invalid component type"); return get<0>(entt); } diff --git a/test/entt/entity/sigh_mixin.cpp b/test/entt/entity/sigh_mixin.cpp index add698130..31a5217ae 100644 --- a/test/entt/entity/sigh_mixin.cpp +++ b/test/entt/entity/sigh_mixin.cpp @@ -494,11 +494,11 @@ TYPED_TEST(SighMixin, ThrowingAllocator) { using registry_type = typename storage_type::registry_type; storage_type pool{}; - typename std::decay_t::base_type &base = pool; + typename storage_type::base_type &base = pool; registry_type registry; - constexpr auto packed_page_size = entt::component_traits::page_size; - constexpr auto sparse_page_size = entt::entt_traits::page_size; + constexpr auto packed_page_size = entt::component_traits::page_size; + constexpr auto sparse_page_size = entt::entt_traits::page_size; std::size_t on_construct{}; std::size_t on_destroy{}; diff --git a/test/example/entity_copy.cpp b/test/example/entity_copy.cpp index a3c81df01..fc754e71f 100644 --- a/test/example/entity_copy.cpp +++ b/test/example/entity_copy.cpp @@ -14,7 +14,7 @@ template // NOLINTNEXTLINE(*-exception-escape) struct meta_mixin: Type { using allocator_type = typename Type::allocator_type; - using value_type = typename Type::value_type; + using element_type = typename Type::element_type; explicit meta_mixin(const allocator_type &allocator); }; @@ -29,11 +29,11 @@ meta_mixin::meta_mixin(const allocator_type &allocator) : Type{allocator} { using namespace entt::literals; - entt::meta() + entt::meta() // cross registry, same type - .template func &(const entt::id_type)>(&entt::basic_registry::storage), entt::as_ref_t>("storage"_hs) + .template func &(const entt::id_type)>(&entt::basic_registry::storage), entt::as_ref_t>("storage"_hs) // cross registry, different types - .template func &(const entt::id_type)>(&entt::basic_registry::storage), entt::as_ref_t>("storage"_hs); + .template func &(const entt::id_type)>(&entt::basic_registry::storage), entt::as_ref_t>("storage"_hs); } template