From efb590c2cdd1bcba2dc5621359b02c938d9263cd Mon Sep 17 00:00:00 2001 From: ouczbs Date: Wed, 30 Oct 2024 15:14:40 +0800 Subject: [PATCH] bugfix --- src/refl/template/meta.liquid | 12 ++---------- src/refl/template/meta_impl.liquid | 18 +----------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/refl/template/meta.liquid b/src/refl/template/meta.liquid index 421f970..1a6d2f1 100644 --- a/src/refl/template/meta.liquid +++ b/src/refl/template/meta.liquid @@ -8,16 +8,8 @@ namespace refl{ using Impl = gen::MetaImpl; {%- endif %} {%- if IsMultyMeta %} - {%- for Meta in MetaList %} - static const UClass* get_{{Meta}}(); - {%- endfor %} - static const UClass* GetMeta(Name name) { - {%- for Meta in MetaList %} - if (name == string_hash("{{Meta}}")) { - return get_{{Meta}}(); - } - {%- endfor %} - return nullptr; + consteval static auto MetaList() { + return std::array{ {% for Meta in MetaList %}string_hash("{{Meta}}"){% unless forloop.last %}, {% endunless %}{% endfor %} }; } {%- endif %} }; diff --git a/src/refl/template/meta_impl.liquid b/src/refl/template/meta_impl.liquid index 76c42dd..15cdbd3 100644 --- a/src/refl/template/meta_impl.liquid +++ b/src/refl/template/meta_impl.liquid @@ -22,20 +22,4 @@ namespace gen{ }; }; }; -} -{%- if MetaType == 1 %} -namespace refl{ - const UClass* Meta<{{FullName}}>::get_{{ MetaName }}() - { - static const UClass_Meta> s_cls{}; - return &s_cls; - }; -} -{%- elsif MetaType == 2 %} -namespace refl{ - inline const UClass* Meta<{{FullName}}>::get_{{ MetaName }}() - { - return &TypeInfo::StaticClass; - }; -} -{%- endif %} \ No newline at end of file +} \ No newline at end of file