| 79 | |
| 80 | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
| 81 | [[nodiscard]] constexpr auto enum_next_value(E value, std::ptrdiff_t n = 1) noexcept -> detail::enable_if_t<E, optional<std::decay_t<E>>> { |
| 82 | using D = std::decay_t<E>; |
| 83 | constexpr std::ptrdiff_t count = detail::count_v<D, S>; |
| 84 | |
| 85 | if (const auto i = enum_index<D, S>(value)) { |
| 86 | const std::ptrdiff_t index = (static_cast<std::ptrdiff_t>(*i) + n); |
| 87 | if (index >= 0 && index < count) { |
| 88 | return enum_value<D, S>(static_cast<std::size_t>(index)); |
| 89 | } |
| 90 | } |
| 91 | return {}; |
| 92 | } |
| 93 | |
| 94 | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
| 95 | [[nodiscard]] constexpr auto enum_next_value_circular(E value, std::ptrdiff_t n = 1) noexcept -> detail::enable_if_t<E, std::decay_t<E>> { |
no outgoing calls
no test coverage detected