[go: nahoru, domu]

Skip to content

Commit

Permalink
fix VS_2017_WORKAROUND for resharper
Browse files Browse the repository at this point in the history
  • Loading branch information
Neargye committed Jun 13, 2023
1 parent fd15349 commit 911cd20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/magic_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ template <typename E, E V>
constexpr auto n() noexcept {
static_assert(is_enum_v<E>, "magic_enum::detail::n requires enum type.");

# if defined(MAGIC_ENUM_GET_ENUM_NAME_BUILTIN)
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};
std::size_t p = 0;
for (std::size_t i = name.size_; i > 0; --i) {
Expand All @@ -544,6 +548,7 @@ constexpr auto n() noexcept {
name = str_view{};
}
return name;
# endif
}
#endif

Expand Down

0 comments on commit 911cd20

Please sign in to comment.