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

Function values

include/magic_enum/magic_enum.hpp:802–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800
801template <typename E, enum_subtype S, std::size_t Size, int Min>
802constexpr auto values() noexcept {
803 constexpr auto vc = valid_count<E, S, Size, Min>();
804
805 if constexpr (vc.count > 0) {
806#if defined(MAGIC_ENUM_ARRAY_CONSTEXPR)
807 std::array<E, vc.count> values = {};
808#else
809 E values[vc.count] = {};
810#endif
811 for (std::size_t i = 0, v = 0; v < vc.count; ++i) {
812 if (vc.valid[i]) {
813 values[v++] = value<E, Min, S>(i);
814 }
815 }
816#if defined(MAGIC_ENUM_ARRAY_CONSTEXPR)
817 return values;
818#else
819 return to_array(values, std::make_index_sequence<vc.count>{});
820#endif
821 } else {
822 return std::array<E, 0>{};
823 }
824}
825
826template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>>
827constexpr auto values() noexcept {

Callers

nothing calls this directly

Calls 1

to_arrayFunction · 0.70

Tested by

no test coverage detected