1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

fix CLI/C++

This commit is contained in:
neargye 2023-06-28 20:05:12 +04:00
parent e1ea11a93d
commit 4904822db8

View file

@ -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
@ -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{};
@ -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] == ':') {