MCPcopy Create free account
hub / github.com/Neargye/magic_enum / reflected_max

Function reflected_max

include/magic_enum/magic_enum.hpp:745–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743
744template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>>
745constexpr int reflected_max() noexcept {
746 if constexpr (S == enum_subtype::flags) {
747 return std::numeric_limits<U>::digits - 1;
748 } else {
749 constexpr auto lhs = range_max<E>::value;
750 constexpr auto rhs = (std::numeric_limits<U>::max)();
751
752 if constexpr (cmp_less(lhs, rhs)) {
753 return lhs;
754 } else {
755 return rhs;
756 }
757 }
758}
759
760#define MAGIC_ENUM_FOR_EACH_256(T) \
761 T( 0)T( 1)T( 2)T( 3)T( 4)T( 5)T( 6)T( 7)T( 8)T( 9)T( 10)T( 11)T( 12)T( 13)T( 14)T( 15)T( 16)T( 17)T( 18)T( 19)T( 20)T( 21)T( 22)T( 23)T( 24)T( 25)T( 26)T( 27)T( 28)T( 29)T( 30)T( 31) \

Callers

nothing calls this directly

Calls 1

cmp_lessFunction · 0.85

Tested by

no test coverage detected