From 8e146a6a7eac3e16a87f757a3e7df213700a95c6 Mon Sep 17 00:00:00 2001 From: metabeyond <metabeyond@outlook.com> Date: Fri, 15 Nov 2024 09:49:23 +0800 Subject: [PATCH] Fixed enum parse issue. --- .../essence/meta/detail/parse_raw_identifier_name.hpp | 5 ++++- include/essence/meta/enum.hpp | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/essence/meta/detail/parse_raw_identifier_name.hpp b/include/essence/meta/detail/parse_raw_identifier_name.hpp index 26585a0..1682eb8 100644 --- a/include/essence/meta/detail/parse_raw_identifier_name.hpp +++ b/include/essence/meta/detail/parse_raw_identifier_name.hpp @@ -35,7 +35,10 @@ #include <cstddef> #include <string_view> + +#ifdef _MSC_VER #include <tuple> +#endif namespace essence::meta::detail { /** @@ -82,7 +85,7 @@ namespace essence::meta::detail { language_tokens::type_prefixes); #else // Skips the possible '&' token for GCC and Clang. - return static_cast<std::size_t>(str[prefix_size] == language_tokens::reference.front()); + return str[prefix_size] == language_tokens::reference.front(); #endif }, }); diff --git a/include/essence/meta/enum.hpp b/include/essence/meta/enum.hpp index 9a9f47f..d24738c 100644 --- a/include/essence/meta/enum.hpp +++ b/include/essence/meta/enum.hpp @@ -52,11 +52,12 @@ namespace essence::meta { template <typename T, bool Short = true> requires std::is_enum_v<T> generator<std::pair<std::string_view, T>> probe_enum_names() { - constexpr auto range = get_enum_searching_range<T>(); - constexpr auto min = range.first; - constexpr auto max = range.second; + const auto origin = []<std::size_t... Is>( + std::index_sequence<Is...>) -> generator<std::pair<std::string_view, T>> { + constexpr auto range = get_enum_searching_range<T>(); + constexpr auto min = range.first; + constexpr auto max = range.second; - auto origin = [&]<std::size_t... Is>(std::index_sequence<Is...>) -> generator<std::pair<std::string_view, T>> { (co_yield std::pair{get_literal_string_v<T, static_cast<T>(min + Is), identifier_param{ .shortened = Short,