| 680 | |
| 681 | template <typename E, auto V> |
| 682 | constexpr bool is_valid() noexcept { |
| 683 | if constexpr (is_enum_constexpr_static_cast_valid<E, V>) { |
| 684 | constexpr E v = static_cast<E>(V); |
| 685 | [[maybe_unused]] constexpr auto custom = customize::enum_name<E>(v); |
| 686 | static_assert(std::is_same_v<std::decay_t<decltype(custom)>, customize::customize_t>, "magic_enum::customize requires customize_t type."); |
| 687 | if constexpr (custom.first == customize::detail::customize_tag::custom_tag) { |
| 688 | constexpr auto name = custom.second; |
| 689 | static_assert(!name.empty(), "magic_enum::customize requires not empty string."); |
| 690 | return name.size() != 0; |
| 691 | } else if constexpr (custom.first == customize::detail::customize_tag::default_tag) { |
| 692 | #if defined(MAGIC_ENUM_VS_2017_WORKAROUND) |
| 693 | return n<E, v>().size_ != 0; |
| 694 | #else |
| 695 | return n<v>().size_ != 0; |
| 696 | #endif |
| 697 | } else { |
| 698 | return false; |
| 699 | } |
| 700 | } else { |
| 701 | return false; |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | enum class enum_subtype { |
| 706 | common, |