Skip to content

Commit

Permalink
remove unnecessary func
Browse files Browse the repository at this point in the history
  • Loading branch information
Neargye committed May 30, 2023
1 parent e59f873 commit 06598d1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions include/magic_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,13 @@ struct range_max<T, std::void_t<decltype(customize::enum_range<T>::max)>> : std:
struct str_view {
const char* str_ = nullptr;
std::size_t size_ = 0;

constexpr const char* data() const noexcept { return str_; }

constexpr std::size_t size() const noexcept { return size_; }
};

template <std::uint16_t N>
class static_str {
public:
constexpr explicit static_str(str_view str) noexcept : static_str{str.str_, std::make_integer_sequence<std::uint16_t, N>{}} {
assert(str.size() == N);
assert(str.size_ == N);
}

constexpr explicit static_str(string_view str) noexcept : static_str{str.data(), std::make_integer_sequence<std::uint16_t, N>{}} {
Expand Down Expand Up @@ -454,7 +450,7 @@ constexpr auto type_name() noexcept {
return static_str<0>{};
} else if constexpr (custom.first == customize::detail::customize_tag::default_tag) {
constexpr auto name = n<E>();
return static_str<name.size()>{name};
return static_str<name.size_>{name};
} else {
static_assert(always_false_v<E>, "magic_enum::customize invalid.");
}
Expand Down Expand Up @@ -524,7 +520,7 @@ constexpr auto enum_name() noexcept {
return static_str<0>{};
} else if constexpr (custom.first == customize::detail::customize_tag::default_tag) {
constexpr auto name = n<V>();
return static_str<name.size()>{name};
return static_str<name.size_>{name};
} else {
static_assert(always_false_v<E>, "magic_enum::customize invalid.");
}
Expand All @@ -548,7 +544,7 @@ constexpr bool is_valid() noexcept {
static_assert(!name.empty(), "magic_enum::customize requires not empty string.");
return name.size() != 0;
} else if constexpr (custom.first == customize::detail::customize_tag::default_tag) {
return n<v>().size() != 0;
return n<v>().size_ != 0;
} else {
return false;
}
Expand Down

0 comments on commit 06598d1

Please sign in to comment.