Lines Matching refs:E

32 template <bool S, typename E, E V>
34 static_assert(std::is_enum_v<E>); in ftl_enum_builder()
74 template <typename E, E V>
76 return ftl_enum_builder<false, E, V>(); in ftl_enum()
80 template <typename E, E V>
82 return ftl_enum_builder<true, E, V>(); in ftl_enum_full()
109 template <typename E, typename = std::enable_if_t<std::is_enum_v<E>>>
110 constexpr auto to_underlying(E v) {
111 return static_cast<std::underlying_type_t<E>>(v);
132 template <typename E, typename = void>
134 static_assert(is_scoped_enum_v<E>, "Missing ftl_first enumerator");
135 static constexpr E value{0};
138 template <typename E>
139 struct enum_begin<E, std::void_t<decltype(E::ftl_first)>> {
140 static constexpr E value = E::ftl_first;
143 template <typename E>
144 inline constexpr E enum_begin_v = enum_begin<E>::value;
146 template <typename E, typename = void>
148 using U = std::underlying_type_t<E>;
149 static_assert(is_scoped_enum_v<E> && std::is_unsigned_v<U>, "Missing ftl_last enumerator");
151 static constexpr E value{std::numeric_limits<U>::digits};
154 template <typename E>
155 struct enum_end<E, std::void_t<decltype(E::ftl_last)>> {
156 static constexpr E value = E{to_underlying(E::ftl_last) + 1};
159 template <typename E>
160 inline constexpr E enum_end_v = enum_end<E>::value;
162 template <typename E>
163 inline constexpr E enum_last_v = E{to_underlying(enum_end_v<E>) - 1};
165 template <typename E>
167 static constexpr auto kBegin = to_underlying(enum_begin_v<E>);
168 static constexpr auto kEnd = to_underlying(enum_end_v<E>);
175 template <typename E>
176 inline constexpr std::size_t enum_size_v = enum_size<E>::value;
185 template <typename E>
186 using make_enum_sequence = std::make_integer_sequence<std::underlying_type_t<E>, enum_size_v<E>>;
188 template <typename E, template <E> class = Identity, typename = make_enum_sequence<E>>
191 template <typename E, template <E> class F, typename T, T... Vs>
192 struct EnumRange<E, F, std::integer_sequence<T, Vs...>> {
193 static constexpr auto kBegin = to_underlying(enum_begin_v<E>);
194 static constexpr auto kSize = enum_size_v<E>;
196 using R = decltype(F<E{}>::value);
197 const R values[kSize] = {F<static_cast<E>(Vs + kBegin)>::value...};
215 using E = decltype(I);
216 using U = std::underlying_type_t<E>;
218 static constexpr E V{U{1} << to_underlying(I)};
219 static constexpr auto value = ftl_enum<E, V>();
235 template <typename E>
237 return details::EnumRange<E>{};
271 template <typename E>
272 constexpr std::optional<std::string_view> enum_name(E v) {
275 constexpr auto kBegin = to_underlying(enum_begin_v<E>);
276 constexpr auto kLast = to_underlying(enum_last_v<E>);
279 constexpr auto kRange = details::EnumRange<E, details::EnumName>{};
290 template <typename E>
291 constexpr std::optional<std::string_view> enum_name_full(E v) {
294 constexpr auto kBegin = to_underlying(enum_begin_v<E>);
295 constexpr auto kLast = to_underlying(enum_last_v<E>);
298 constexpr auto kRange = details::EnumRange<E, details::EnumNameFull>{};
309 template <typename E>
310 constexpr std::optional<std::string_view> flag_name(E v) {
316 constexpr auto kRange = details::EnumRange<E, details::FlagName>{};
327 template <typename E>
328 inline std::string enum_string(E v) {
342 template <typename E>
343 inline std::string enum_string_full(E v) {
357 template <typename E>
358 inline std::string flag_string(E v) {
362 constexpr auto radix = sizeof(E) == 1 ? Radix::kBin : Radix::kHex;