Skip to content

Commit

Permalink
Fixed enum parse issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
refvalue committed Nov 15, 2024
1 parent 144f02a commit 8e146a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion include/essence/meta/detail/parse_raw_identifier_name.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@

#include <cstddef>
#include <string_view>

#ifdef _MSC_VER
#include <tuple>
#endif

namespace essence::meta::detail {
/**
Expand Down Expand Up @@ -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
},
});
Expand Down
9 changes: 5 additions & 4 deletions include/essence/meta/enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8e146a6

Please sign in to comment.