meta: meta_node<>::ctx -> meta_node<>::global

This commit is contained in:
Michele Caini
2019-10-14 22:42:37 +02:00
parent b0ea150e94
commit c1117e260c
3 changed files with 12 additions and 12 deletions

View File

@@ -265,11 +265,11 @@ class meta_factory {
auto record(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
auto * const node = internal::meta_info<Type>::resolve();
ENTT_ASSERT(!duplicate(identifier, *internal::meta_info<>::ctx));
ENTT_ASSERT(!duplicate(node, *internal::meta_info<>::ctx));
ENTT_ASSERT(!duplicate(identifier, *internal::meta_info<>::global));
ENTT_ASSERT(!duplicate(node, *internal::meta_info<>::global));
node->identifier = identifier;
node->next = *internal::meta_info<>::ctx;
*internal::meta_info<>::ctx = node;
node->next = *internal::meta_info<>::global;
*internal::meta_info<>::global = node;
return extended_meta_factory<Type>{&node->prop};
}
@@ -772,7 +772,7 @@ inline meta_type resolve() ENTT_NOEXCEPT {
inline meta_type resolve(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
return internal::find_if([identifier](auto *node) {
return node->identifier == identifier;
}, *internal::meta_info<>::ctx);
}, *internal::meta_info<>::global);
}
@@ -784,7 +784,7 @@ inline meta_type resolve(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
template<typename Op>
inline std::enable_if_t<std::is_invocable_v<Op, meta_type>, void>
resolve(Op op) ENTT_NOEXCEPT {
internal::iterate<meta_type>(std::move(op), *internal::meta_info<>::ctx);
internal::iterate<meta_type>(std::move(op), *internal::meta_info<>::global);
}

View File

@@ -198,7 +198,7 @@ struct meta_node;
template<>
struct meta_node<> {
inline static meta_type_node *local = nullptr;
inline static meta_type_node **ctx = &local;
inline static meta_type_node **global = &local;
};
@@ -208,7 +208,7 @@ struct meta_node<Type> {
static void reset() ENTT_NOEXCEPT {
auto * const node = resolve();
auto **curr = meta_node<>::ctx;
auto **curr = meta_node<>::global;
while(*curr && *curr != node) {
curr = &(*curr)->next;
@@ -267,7 +267,7 @@ struct meta_node<Type> {
if constexpr(is_named_type_v<Type>) {
auto *candidate = internal::find_if([](auto *candidate) {
return candidate->identifier == named_type_traits<Type>::value;
}, *meta_node<>::ctx);
}, *meta_node<>::global);
return candidate ? candidate : &node;
} else {
@@ -1733,7 +1733,7 @@ private:
struct meta_ctx {
/*! @brief Sets the context as the current one. */
void set() const ENTT_NOEXCEPT {
internal::meta_info<>::ctx = ctx;
internal::meta_info<>::global = ctx;
}
private:

View File

@@ -2014,7 +2014,7 @@ TEST_F(Meta, SharedProperties) {
}
TEST_F(Meta, Reset) {
ASSERT_NE(*entt::internal::meta_info<>::ctx, nullptr);
ASSERT_NE(*entt::internal::meta_info<>::global, nullptr);
ASSERT_NE(entt::internal::meta_info<>::local, nullptr);
entt::meta<char>().reset();
@@ -2033,7 +2033,7 @@ TEST_F(Meta, Reset) {
entt::meta<another_abstract_type>().reset();
entt::meta<unsigned int>().reset();
ASSERT_EQ(*entt::internal::meta_info<>::ctx, nullptr);
ASSERT_EQ(*entt::internal::meta_info<>::global, nullptr);
ASSERT_EQ(entt::internal::meta_info<>::local, nullptr);
ASSERT_FALSE(entt::resolve("char"_hs));