From 144f02a78447414c03f3400148d0e55535b3e83c Mon Sep 17 00:00:00 2001 From: metabeyond Date: Thu, 14 Nov 2024 22:39:00 +0800 Subject: [PATCH] Fixed enum parse issue. --- .../essence/meta/detail/parse_raw_identifier_name.hpp | 4 ++-- include/essence/meta/enum.hpp | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/essence/meta/detail/parse_raw_identifier_name.hpp b/include/essence/meta/detail/parse_raw_identifier_name.hpp index ea7f013..26585a0 100644 --- a/include/essence/meta/detail/parse_raw_identifier_name.hpp +++ b/include/essence/meta/detail/parse_raw_identifier_name.hpp @@ -43,7 +43,7 @@ namespace essence::meta::detail { * @param raw_name The raw name. * @return The short identifier name. */ - consteval std::string_view get_short_identifier_name(std::string_view raw_name) noexcept { + constexpr std::string_view get_short_identifier_name(std::string_view raw_name) noexcept { return extract_keyword( raw_name, language_tokens::scope, extraction_param{.ensure_correctness = false}); } @@ -55,7 +55,7 @@ namespace essence::meta::detail { * @param param The parameter for parsing the identifier. * @return The remaining part. */ - consteval std::string_view parse_raw_identifier_name( + constexpr std::string_view parse_raw_identifier_name( std::string_view prefix, std::string_view signature, const identifier_param& param = {}) noexcept { #ifdef _MSC_VER const auto keyword = prefix; diff --git a/include/essence/meta/enum.hpp b/include/essence/meta/enum.hpp index 5ed943d..9a9f47f 100644 --- a/include/essence/meta/enum.hpp +++ b/include/essence/meta/enum.hpp @@ -56,19 +56,12 @@ namespace essence::meta { constexpr auto min = range.first; constexpr auto max = range.second; - struct dummy { - static constexpr auto copy(std::string_view str) noexcept { - // ReSharper disable once CppDFALocalValueEscapesFunction - return str; - } - }; - auto origin = [&](std::index_sequence) -> generator> { - (co_yield std::pair{dummy::copy(get_literal_string_v(min + Is), + (co_yield std::pair{get_literal_string_v(min + Is), identifier_param{ .shortened = Short, .ensure_correctness = false, - }>()), + }>(), static_cast(min + Is)}, ...); }(std::make_index_sequence{});