diff --git a/src/entt/entity/handle.hpp b/src/entt/entity/handle.hpp index 70f56d2b9..42fcb7921 100644 --- a/src/entt/entity/handle.hpp +++ b/src/entt/entity/handle.hpp @@ -106,7 +106,7 @@ struct basic_handle { /*! @brief Constructs an invalid handle. */ basic_handle() noexcept - : reg{}, + : owner{}, entt{null} {} /** @@ -115,7 +115,7 @@ struct basic_handle { * @param value A valid identifier. */ basic_handle(registry_type &ref, entity_type value) noexcept - : reg{&ref}, + : owner{&ref}, entt{value} {} /** @@ -129,7 +129,7 @@ struct basic_handle { * @return An iterable object to use to _visit_ the handle. */ [[nodiscard]] auto storage() const noexcept { - auto iterable = reg->storage(); + auto iterable = owner->storage(); using iterator_type = internal::handle_storage_iterator; return iterable_adaptor{iterator_type{entt, iterable.begin(), iterable.end()}, iterator_type{entt, iterable.end(), iterable.end()}}; } @@ -145,7 +145,7 @@ struct basic_handle { operator basic_handle() const noexcept { static_assert(std::is_same_v || std::is_same_v, Registry>, "Invalid conversion between different handles"); static_assert((sizeof...(Scope) == 0 || ((sizeof...(Args) != 0 && sizeof...(Args) <= sizeof...(Scope)) && ... && (type_list_contains_v, Args>))), "Invalid conversion between different handles"); - return reg ? basic_handle{*reg, entt} : basic_handle{}; + return owner ? basic_handle{*owner, entt} : basic_handle{}; } /** @@ -162,7 +162,7 @@ struct basic_handle { * otherwise. */ [[nodiscard]] explicit operator bool() const noexcept { - return reg && reg->valid(entt); + return owner && owner->valid(entt); } /** @@ -170,7 +170,7 @@ struct basic_handle { * @return True if the handle refers to a valid entity, false otherwise. */ [[nodiscard]] bool valid() const { - return reg->valid(entt); + return owner->valid(entt); } /** @@ -178,7 +178,7 @@ struct basic_handle { * @return A pointer to the underlying registry, if any. */ [[nodiscard]] registry_type *registry() const noexcept { - return reg; + return owner; } /** @@ -191,7 +191,7 @@ struct basic_handle { /*! @brief Destroys the entity associated with a handle. */ void destroy() { - reg->destroy(std::exchange(entt, null)); + owner->destroy(std::exchange(entt, null)); } /** @@ -199,7 +199,7 @@ struct basic_handle { * @param version A desired version upon destruction. */ void destroy(const version_type version) { - reg->destroy(std::exchange(entt, null), version); + owner->destroy(std::exchange(entt, null), version); } /** @@ -212,7 +212,7 @@ struct basic_handle { template decltype(auto) emplace(Args &&...args) const { static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template emplace(entt, std::forward(args)...); + return owner->template emplace(entt, std::forward(args)...); } /** @@ -225,7 +225,7 @@ struct basic_handle { template decltype(auto) emplace_or_replace(Args &&...args) const { static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template emplace_or_replace(entt, std::forward(args)...); + return owner->template emplace_or_replace(entt, std::forward(args)...); } /** @@ -238,7 +238,7 @@ struct basic_handle { template decltype(auto) patch(Func &&...func) const { static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template patch(entt, std::forward(func)...); + return owner->template patch(entt, std::forward(func)...); } /** @@ -251,7 +251,7 @@ struct basic_handle { template decltype(auto) replace(Args &&...args) const { static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template replace(entt, std::forward(args)...); + return owner->template replace(entt, std::forward(args)...); } /** @@ -262,7 +262,7 @@ struct basic_handle { template size_type remove() const { static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); - return reg->template remove(entt); + return owner->template remove(entt); } /** @@ -272,7 +272,7 @@ struct basic_handle { template void erase() const { static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); - reg->template erase(entt); + owner->template erase(entt); } /** @@ -282,7 +282,7 @@ struct basic_handle { */ template [[nodiscard]] decltype(auto) all_of() const { - return reg->template all_of(entt); + return owner->template all_of(entt); } /** @@ -293,7 +293,7 @@ struct basic_handle { */ template [[nodiscard]] decltype(auto) any_of() const { - return reg->template any_of(entt); + return owner->template any_of(entt); } /** @@ -304,7 +304,7 @@ struct basic_handle { template [[nodiscard]] decltype(auto) get() const { static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); - return reg->template get(entt); + return owner->template get(entt); } /** @@ -317,7 +317,7 @@ struct basic_handle { template [[nodiscard]] decltype(auto) get_or_emplace(Args &&...args) const { static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template get_or_emplace(entt, std::forward(args)...); + return owner->template get_or_emplace(entt, std::forward(args)...); } /** @@ -328,7 +328,7 @@ struct basic_handle { template [[nodiscard]] auto try_get() const { static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); - return reg->template try_get(entt); + return owner->template try_get(entt); } /** @@ -336,11 +336,11 @@ struct basic_handle { * @return True if the handle has no elements assigned, false otherwise. */ [[nodiscard]] bool orphan() const { - return reg->orphan(entt); + return owner->orphan(entt); } private: - registry_type *reg; + registry_type *owner; entity_type entt; };