meta: cleanup/further reduce instantiations
This commit is contained in:
@@ -218,7 +218,7 @@ struct meta_factory<Type> {
|
||||
static internal::meta_base_node node{
|
||||
type,
|
||||
nullptr,
|
||||
&internal::meta_info<Base>::resolve,
|
||||
internal::meta_info<Base>::resolve(),
|
||||
[](const void *instance) ENTT_NOEXCEPT -> const void * {
|
||||
return static_cast<const Base *>(static_cast<const Type *>(instance));
|
||||
}
|
||||
@@ -252,7 +252,7 @@ struct meta_factory<Type> {
|
||||
static internal::meta_conv_node node{
|
||||
type,
|
||||
nullptr,
|
||||
&internal::meta_info<conv_type>::resolve,
|
||||
internal::meta_info<conv_type>::resolve(),
|
||||
[](const void *instance) -> meta_any {
|
||||
return (static_cast<const Type *>(instance)->*Candidate)();
|
||||
}
|
||||
@@ -275,7 +275,7 @@ struct meta_factory<Type> {
|
||||
static internal::meta_conv_node node{
|
||||
type,
|
||||
nullptr,
|
||||
&internal::meta_info<conv_type>::resolve,
|
||||
internal::meta_info<conv_type>::resolve(),
|
||||
[](const void *instance) -> meta_any {
|
||||
return Candidate(*static_cast<const Type *>(instance));
|
||||
}
|
||||
@@ -306,7 +306,7 @@ struct meta_factory<Type> {
|
||||
static internal::meta_conv_node node{
|
||||
type,
|
||||
nullptr,
|
||||
&internal::meta_info<To>::resolve,
|
||||
internal::meta_info<To>::resolve(),
|
||||
[](const void *instance) -> meta_any {
|
||||
return static_cast<To>(*static_cast<const Type *>(instance));
|
||||
}
|
||||
@@ -444,7 +444,7 @@ struct meta_factory<Type> {
|
||||
nullptr,
|
||||
std::is_same_v<Type, data_type> || std::is_const_v<data_type>,
|
||||
true,
|
||||
&internal::meta_info<data_type>::resolve,
|
||||
internal::meta_info<data_type>::resolve(),
|
||||
&meta_setter<Type, Data>,
|
||||
&meta_getter<Type, Data, Policy>
|
||||
};
|
||||
@@ -493,7 +493,7 @@ struct meta_factory<Type> {
|
||||
nullptr,
|
||||
std::is_same_v<decltype(Setter), std::nullptr_t> || (std::is_member_object_pointer_v<decltype(Setter)> && std::is_const_v<underlying_type>),
|
||||
false,
|
||||
&internal::meta_info<underlying_type>::resolve,
|
||||
internal::meta_info<underlying_type>::resolve(),
|
||||
&meta_setter<Type, Setter>,
|
||||
&meta_getter<Type, Getter, Policy>
|
||||
};
|
||||
@@ -535,7 +535,7 @@ struct meta_factory<Type> {
|
||||
descriptor::args_type::size,
|
||||
descriptor::is_const,
|
||||
descriptor::is_static,
|
||||
&internal::meta_info<std::conditional_t<std::is_same_v<Policy, as_void_t>, void, typename descriptor::return_type>>::resolve,
|
||||
internal::meta_info<std::conditional_t<std::is_same_v<Policy, as_void_t>, void, typename descriptor::return_type>>::resolve(),
|
||||
&meta_arg<typename descriptor::args_type>,
|
||||
&meta_invoke<Type, Candidate, Policy>
|
||||
};
|
||||
|
||||
@@ -197,13 +197,13 @@ class meta_any {
|
||||
template<auto Member>
|
||||
[[nodiscard]] static std::decay_t<decltype(std::declval<internal::meta_type_node>().*Member)> visit(const type_info &info, const internal::meta_type_node *node) {
|
||||
for(auto *curr = node->*Member; curr; curr = curr->next) {
|
||||
if(curr->type()->info == info) {
|
||||
if(curr->type->info == info) {
|
||||
return curr;
|
||||
}
|
||||
}
|
||||
|
||||
for(auto *curr = node->base; curr; curr = curr->next) {
|
||||
if(auto *ret = visit<Member>(info, curr->type()); ret) {
|
||||
if(auto *ret = visit<Member>(info, curr->type); ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1081,13 +1081,13 @@ class meta_type {
|
||||
}
|
||||
|
||||
for(const auto *curr = type->conv; curr; curr = curr->next) {
|
||||
if(curr->type()->info == info) {
|
||||
if(curr->type->info == info) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for(const auto *curr = type->base; curr; curr = curr->next) {
|
||||
if(can_cast_or_convert(curr->type(), info)) {
|
||||
if(can_cast_or_convert(curr->type, info)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ class meta_type {
|
||||
}
|
||||
|
||||
for(auto *curr = node->base; curr; curr = curr->next) {
|
||||
if(auto *ret = visit<Member>(op, curr->type()); ret) {
|
||||
if(auto *ret = visit<Member>(op, curr->type); ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ public:
|
||||
* @param curr The base node with which to construct the instance.
|
||||
*/
|
||||
meta_type(base_node_type *curr) ENTT_NOEXCEPT
|
||||
: node{curr ? curr->type() : nullptr}
|
||||
: node{curr ? curr->type : nullptr}
|
||||
{}
|
||||
|
||||
/**
|
||||
@@ -1320,7 +1320,7 @@ public:
|
||||
* @return The tag for the class template of the underlying type.
|
||||
*/
|
||||
[[nodiscard]] inline meta_type template_type() const ENTT_NOEXCEPT {
|
||||
return node->templ ? node->templ->type() : meta_type{};
|
||||
return node->templ ? node->templ->type : meta_type{};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1382,7 +1382,7 @@ public:
|
||||
* @return The base meta type associated with the given identifier, if any.
|
||||
*/
|
||||
[[nodiscard]] meta_type base(const id_type id) const {
|
||||
return visit<&node_type::base>([id](const auto *curr) { return curr->type()->id == id; }, node);
|
||||
return visit<&node_type::base>([id](const auto *curr) { return curr->type->id == id; }, node);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1711,7 +1711,7 @@ bool meta_any::set(const id_type id, Type &&value) {
|
||||
|
||||
|
||||
[[nodiscard]] inline meta_type meta_data::type() const ENTT_NOEXCEPT {
|
||||
return node->type();
|
||||
return node->type;
|
||||
}
|
||||
|
||||
|
||||
@@ -1721,7 +1721,7 @@ bool meta_any::set(const id_type id, Type &&value) {
|
||||
|
||||
|
||||
[[nodiscard]] inline meta_type meta_func::ret() const ENTT_NOEXCEPT {
|
||||
return node->ret();
|
||||
return node->ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ struct meta_prop_node {
|
||||
struct meta_base_node {
|
||||
meta_type_node * const parent;
|
||||
meta_base_node * next;
|
||||
meta_type_node *(* const type)() ENTT_NOEXCEPT;
|
||||
meta_type_node * const type;
|
||||
const void *(* const cast)(const void *) ENTT_NOEXCEPT;
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ struct meta_base_node {
|
||||
struct meta_conv_node {
|
||||
meta_type_node * const parent;
|
||||
meta_conv_node * next;
|
||||
meta_type_node *(* const type)() ENTT_NOEXCEPT;
|
||||
meta_type_node * const type;
|
||||
meta_any(* const conv)(const void *);
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ struct meta_data_node {
|
||||
meta_prop_node * prop;
|
||||
const bool is_const;
|
||||
const bool is_static;
|
||||
meta_type_node *(* const type)() ENTT_NOEXCEPT;
|
||||
meta_type_node * const type;
|
||||
bool(* const set)(meta_handle, meta_any);
|
||||
meta_any(* const get)(meta_handle);
|
||||
};
|
||||
@@ -89,7 +89,7 @@ struct meta_func_node {
|
||||
const size_type arity;
|
||||
const bool is_const;
|
||||
const bool is_static;
|
||||
meta_type_node *(* const ret)() ENTT_NOEXCEPT;
|
||||
meta_type_node * const ret;
|
||||
meta_type(* const arg)(const size_type) ENTT_NOEXCEPT;
|
||||
meta_any(* const invoke)(meta_handle, meta_any * const);
|
||||
};
|
||||
@@ -98,7 +98,7 @@ struct meta_func_node {
|
||||
struct meta_template_node {
|
||||
using size_type = std::size_t;
|
||||
const size_type arity;
|
||||
meta_type_node *(* const type)() ENTT_NOEXCEPT;
|
||||
meta_type_node * const type;
|
||||
meta_type_node *(* const arg)(const size_type) ENTT_NOEXCEPT;
|
||||
};
|
||||
|
||||
@@ -175,7 +175,7 @@ class ENTT_API meta_node {
|
||||
if constexpr(is_complete_v<meta_template_traits<Type>>) {
|
||||
static meta_template_node node{
|
||||
meta_template_traits<Type>::args_type::size,
|
||||
&meta_node<typename meta_template_traits<Type>::class_type>::resolve,
|
||||
meta_node<typename meta_template_traits<Type>::class_type>::resolve(),
|
||||
[](const std::size_t index) ENTT_NOEXCEPT {
|
||||
return meta_arg_node(typename meta_template_traits<Type>::args_type{}, index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user