Skip to content

Commit

Permalink
fix CLI/C++
Browse files Browse the repository at this point in the history
  • Loading branch information
Neargye committed Jun 28, 2023
1 parent e1ea11a commit 4904822
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions include/magic_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,10 @@ constexpr auto n() noexcept {
name.str_ += 37;
}
#elif defined(_MSC_VER)
auto name = str_view{__FUNCSIG__ + 40, sizeof(__FUNCSIG__) - 57};
str_view name;
name.str_ = __FUNCSIG__;
name.str_ += 40;
name.size_ += sizeof(__FUNCSIG__) - 57;
#else
auto name = str_view{};
#endif
Expand Down Expand Up @@ -508,7 +511,9 @@ constexpr auto n() noexcept {
#elif defined(_MSC_VER)
str_view name;
if ((__FUNCSIG__[5] == '_' && __FUNCSIG__[35] != '(') || (__FUNCSIG__[5] == 'c' && __FUNCSIG__[41] != '(')) {
name = str_view{__FUNCSIG__ + 35, sizeof(__FUNCSIG__) - 52};
name.str_ = __FUNCSIG__;
name.str_ += 35;
name.size_ = sizeof(__FUNCSIG__) - 52;
}
#else
auto name = str_view{};
Expand Down Expand Up @@ -543,7 +548,9 @@ constexpr auto n() noexcept {
constexpr auto name_ptr = MAGIC_ENUM_GET_ENUM_NAME_BUILTIN(V);
auto name = name_ptr ? str_view{name_ptr, std::char_traits<char>::length(name_ptr)} : str_view{};
# else
str_view name = str_view{__FUNCSIG__, sizeof(__FUNCSIG__) - 17};
str_view name;
name.str_ = __FUNCSIG__;
name.size_ = sizeof(__FUNCSIG__) - 17;
std::size_t p = 0;
for (std::size_t i = name.size_; i > 0; --i) {
if (name.str_[i] == ',' || name.str_[i] == ':') {
Expand Down

0 comments on commit 4904822

Please sign in to comment.