From 5be1bf7d82612b6310f19ae97c9a75593fe456cd Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 1 Dec 2019 17:25:38 +0100 Subject: [PATCH] meta no longer uses named types --- src/entt/meta/factory.hpp | 34 +++++++--------------------------- src/entt/meta/meta.hpp | 10 +--------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/src/entt/meta/factory.hpp b/src/entt/meta/factory.hpp index df0e4daab..a5a969bdd 100644 --- a/src/entt/meta/factory.hpp +++ b/src/entt/meta/factory.hpp @@ -381,7 +381,13 @@ class meta_factory { return node && (node->identifier == identifier || duplicate(identifier, node->next)); } - auto record(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT { +public: + /** + * @brief Extends a meta type by assigning it an identifier. + * @param identifier Unique identifier. + * @return An extended meta factory for the given type. + */ + auto type(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT { auto * const node = internal::meta_info::resolve(); ENTT_ASSERT(!duplicate(identifier, *internal::meta_info<>::global)); @@ -393,32 +399,6 @@ class meta_factory { return meta_factory{&node->prop}; } -public: - /** - * @brief Extends a meta type by assigning it an identifier. - * - * This function is intended only for unnamed types. - * - * @param identifier Unique identifier. - * @return An extended meta factory for the given type. - */ - auto type(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT { - static_assert(!is_named_type_v); - return record(identifier); - } - - /** - * @brief Extends a meta type by assigning it an identifier. - * - * This function is intended only for named types - * - * @return An extended meta factory for the given type. - */ - auto type() ENTT_NOEXCEPT { - static_assert(is_named_type_v); - return record(named_type_traits_t::value); - } - /** * @brief Assigns a meta base to a meta type. * diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index a6629cac1..3d6b9a7f6 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -264,15 +264,7 @@ struct meta_node { } }; - if constexpr(is_named_type_v) { - auto *candidate = internal::find_if([](const auto *curr) { - return curr->identifier == named_type_traits_v; - }, *meta_node<>::global); - - return candidate ? candidate : &node; - } else { - return &node; - } + return &node; } };