Skip to content

Commit

Permalink
meta: internal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Aug 27, 2024
1 parent c909b40 commit 27f7e43
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/entt/meta/meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ class meta_type {

if(!can_continue && type.node.details) {
for(std::size_t idx{}, last = type.node.details->base.size(); !can_continue && idx != last; ++idx) {
can_continue = (type.node.details->base[idx].id == info.hash());
can_continue = (type.node.details->base[idx].type == info.hash());
}

for(std::size_t idx{}, last = type.node.details->conv.size(); !can_continue && idx != last; ++idx) {
Expand Down Expand Up @@ -1240,7 +1240,7 @@ class meta_type {
* @param curr The underlying node with which to construct the instance.
*/
meta_type(const meta_ctx &area, const internal::meta_base_node &curr) noexcept
: meta_type{area, curr.type(internal::meta_context::from(area))} {}
: meta_type{area, curr.resolve(internal::meta_context::from(area))} {}

/**
* @brief Returns the type info object of the underlying type.
Expand Down
10 changes: 5 additions & 5 deletions src/entt/meta/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ struct meta_prop_node {
};

struct meta_base_node {
id_type id{};
meta_type_node (*type)(const meta_context &) noexcept {};
id_type type{};
meta_type_node (*resolve)(const meta_context &) noexcept {};
const void *(*cast)(const void *) noexcept {};
};

Expand Down Expand Up @@ -170,7 +170,7 @@ auto *look_for(const meta_context &context, const meta_type_node &node, const id
}

for(auto &&curr: node.details->base) {
if(auto *elem = look_for<Member>(context, curr.type(context), id); elem) {
if(auto *elem = look_for<Member>(context, curr.resolve(context), id); elem) {
return elem;
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ template<typename... Args>

if(from.details) {
for(auto &&curr: from.details->base) {
if(const void *elem = try_cast(context, curr.type(context), to, curr.cast(instance)); elem) {
if(const void *elem = try_cast(context, curr.resolve(context), to, curr.cast(instance)); elem) {
return elem;
}
}
Expand All @@ -221,7 +221,7 @@ template<typename Func>
}

for(auto &&curr: from.details->base) {
if(auto other = try_convert(context, curr.type(context), to, arithmetic_or_enum, curr.cast(instance), func); other) {
if(auto other = try_convert(context, curr.resolve(context), to, arithmetic_or_enum, curr.cast(instance), func); other) {
return other;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/entt/meta/range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace entt {
/*! @cond TURN_OFF_DOXYGEN */
namespace internal {

struct meta_base_node;

template<typename Type, typename It>
struct meta_range_iterator final {
using value_type = std::pair<id_type, Type>;
Expand Down Expand Up @@ -69,6 +71,8 @@ struct meta_range_iterator final {
[[nodiscard]] constexpr reference operator[](const difference_type value) const noexcept {
if constexpr(std::is_same_v<It, typename decltype(meta_context::value)::const_iterator>) {
return {it[value].first, Type{*ctx, it[value].second}};
} else if constexpr(std::is_same_v<typename std::iterator_traits<It>::value_type, meta_base_node>) {
return {it[value].type, Type{*ctx, it[value]}};
} else {
return {it[value].id, Type{*ctx, it[value]}};
}
Expand Down

0 comments on commit 27f7e43

Please sign in to comment.