/src/magic_enum/include/magic_enum/magic_enum.hpp
Line | Count | Source |
1 | | // __ __ _ ______ _____ |
2 | | // | \/ | (_) | ____| / ____|_ _ |
3 | | // | \ / | __ _ __ _ _ ___ | |__ _ __ _ _ _ __ ___ | | _| |_ _| |_ |
4 | | // | |\/| |/ _` |/ _` | |/ __| | __| | '_ \| | | | '_ ` _ \ | | |_ _|_ _| |
5 | | // | | | | (_| | (_| | | (__ | |____| | | | |_| | | | | | | | |____|_| |_| |
6 | | // |_| |_|\__,_|\__, |_|\___| |______|_| |_|\__,_|_| |_| |_| \_____| |
7 | | // __/ | https://github.com/Neargye/magic_enum |
8 | | // |___/ version 0.9.8 |
9 | | // |
10 | | // Licensed under the MIT License <http://opensource.org/licenses/MIT>. |
11 | | // SPDX-License-Identifier: MIT |
12 | | // Copyright (c) 2019 - 2026 Daniil Goncharov <neargye@gmail.com>. |
13 | | // |
14 | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
15 | | // of this software and associated documentation files (the "Software"), to deal |
16 | | // in the Software without restriction, including without limitation the rights |
17 | | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
18 | | // copies of the Software, and to permit persons to whom the Software is |
19 | | // furnished to do so, subject to the following conditions: |
20 | | // |
21 | | // The above copyright notice and this permission notice shall be included in all |
22 | | // copies or substantial portions of the Software. |
23 | | // |
24 | | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
25 | | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
26 | | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
27 | | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
28 | | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
29 | | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
30 | | // SOFTWARE. |
31 | | |
32 | | #ifndef NEARGYE_MAGIC_ENUM_HPP |
33 | | #define NEARGYE_MAGIC_ENUM_HPP |
34 | | |
35 | | #define MAGIC_ENUM_VERSION_MAJOR 0 |
36 | | #define MAGIC_ENUM_VERSION_MINOR 9 |
37 | | #define MAGIC_ENUM_VERSION_PATCH 8 |
38 | | |
39 | | #ifndef MAGIC_ENUM_USE_STD_MODULE |
40 | | # include <array> |
41 | | # include <cstddef> |
42 | | # include <cstdint> |
43 | | # include <functional> |
44 | | # include <limits> |
45 | | # include <type_traits> |
46 | | # include <utility> |
47 | | #endif |
48 | | |
49 | | #if defined(MAGIC_ENUM_CONFIG_FILE) |
50 | | # include MAGIC_ENUM_CONFIG_FILE |
51 | | #endif |
52 | | |
53 | | // MAGIC_ENUM_USE_STD_MODULE imports the standard library before this header. |
54 | | #if !defined(MAGIC_ENUM_FORCE_COMPILER_SPECIFIC_REFLECTION) && defined(__cpp_impl_reflection) && __cpp_impl_reflection >= 202506L && defined(__cpp_expansion_statements) && __cpp_expansion_statements >= 202506L |
55 | | # if !defined(MAGIC_ENUM_USE_STD_MODULE) && defined(__has_include) |
56 | | # if __has_include(<meta>) |
57 | | # include <meta> |
58 | | # endif |
59 | | # endif |
60 | | # if defined(__cpp_lib_reflection) && __cpp_lib_reflection >= 202506L && defined(__cpp_lib_define_static) && __cpp_lib_define_static >= 202506L |
61 | | # define MAGIC_ENUM_DETAIL_USE_STD_REFLECTION 1 |
62 | | # endif |
63 | | #endif |
64 | | |
65 | | #ifndef MAGIC_ENUM_USE_STD_MODULE |
66 | | # if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
67 | | # include <algorithm> |
68 | | # endif |
69 | | # if !defined(MAGIC_ENUM_USING_ALIAS_OPTIONAL) |
70 | | # include <optional> |
71 | | # endif |
72 | | # if !defined(MAGIC_ENUM_USING_ALIAS_STRING) |
73 | | # include <string> |
74 | | # endif |
75 | | # if !defined(MAGIC_ENUM_USING_ALIAS_STRING_VIEW) |
76 | | # include <string_view> |
77 | | # endif |
78 | | #endif |
79 | | |
80 | | #if defined(MAGIC_ENUM_NO_ASSERT) && defined(MAGIC_ENUM_ASSERT) |
81 | | # error MAGIC_ENUM_NO_ASSERT and MAGIC_ENUM_ASSERT cannot be used together. |
82 | | #elif defined(MAGIC_ENUM_NO_ASSERT) |
83 | | # define MAGIC_ENUM_ASSERT(...) static_cast<void>(0) |
84 | | #elif !defined(MAGIC_ENUM_ASSERT) |
85 | | # include <cassert> |
86 | 42.5k | # define MAGIC_ENUM_ASSERT(...) assert((__VA_ARGS__)) |
87 | | #endif |
88 | | |
89 | | #if defined(__clang__) |
90 | | # pragma clang diagnostic push |
91 | | # pragma clang diagnostic ignored "-Wunknown-warning-option" |
92 | | # pragma clang diagnostic ignored "-Wenum-constexpr-conversion" |
93 | | #elif defined(_MSC_VER) |
94 | | # pragma warning(push) |
95 | | # pragma warning(disable : 28020) // MSVC analyzer loses constexpr array bounds in template instantiations. |
96 | | # pragma warning(disable : 4514) // Unreferenced inline function has been removed. |
97 | | #endif |
98 | | |
99 | | // Checks magic_enum compiler compatibility. |
100 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) || defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1910 || defined(__RESHARPER__) |
101 | | # undef MAGIC_ENUM_SUPPORTED |
102 | | # define MAGIC_ENUM_SUPPORTED 1 |
103 | | #endif |
104 | | |
105 | | // Checks magic_enum compiler aliases compatibility. |
106 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) || defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1920 |
107 | | # undef MAGIC_ENUM_SUPPORTED_ALIASES |
108 | | # define MAGIC_ENUM_SUPPORTED_ALIASES 1 |
109 | | #endif |
110 | | |
111 | | // Specify calling convention for compilers that need it to produce reliable mangled names under different compiler flags. In particular, MSVC allows changing default calling convention on x86. |
112 | | #if defined(__clang__) || defined(__GNUC__) |
113 | | #define MAGIC_ENUM_CALLING_CONVENTION |
114 | | #elif defined(_MSC_VER) |
115 | | #define MAGIC_ENUM_CALLING_CONVENTION __cdecl |
116 | | #elif defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
117 | | #define MAGIC_ENUM_CALLING_CONVENTION |
118 | | #endif |
119 | | |
120 | | // Enum value must be greater or equals than MAGIC_ENUM_RANGE_MIN. By default MAGIC_ENUM_RANGE_MIN = -128. |
121 | | // If need another min range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MIN. |
122 | | #if !defined(MAGIC_ENUM_RANGE_MIN) |
123 | | # define MAGIC_ENUM_RANGE_MIN -128 |
124 | | #endif |
125 | | |
126 | | // Enum value must be less or equals than MAGIC_ENUM_RANGE_MAX. By default MAGIC_ENUM_RANGE_MAX = 127. |
127 | | // If need another max range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MAX. |
128 | | #if !defined(MAGIC_ENUM_RANGE_MAX) |
129 | | # define MAGIC_ENUM_RANGE_MAX 127 |
130 | | #endif |
131 | | |
132 | | // Improve ReSharper C++ intellisense performance with builtins, avoiding unnecessary template instantiations. |
133 | | #if defined(__RESHARPER__) |
134 | | # undef MAGIC_ENUM_GET_ENUM_NAME_BUILTIN |
135 | | # undef MAGIC_ENUM_GET_TYPE_NAME_BUILTIN |
136 | | # if __RESHARPER__ >= 20230100 |
137 | | # define MAGIC_ENUM_GET_ENUM_NAME_BUILTIN(V) __rscpp_enumerator_name(V) |
138 | | # define MAGIC_ENUM_GET_TYPE_NAME_BUILTIN(T) __rscpp_type_name<T>() |
139 | | # else |
140 | | # define MAGIC_ENUM_GET_ENUM_NAME_BUILTIN(V) nullptr |
141 | | # define MAGIC_ENUM_GET_TYPE_NAME_BUILTIN(T) nullptr |
142 | | # endif |
143 | | #endif |
144 | | |
145 | | namespace magic_enum { |
146 | | |
147 | | // If need another optional type, define the macro MAGIC_ENUM_USING_ALIAS_OPTIONAL. |
148 | | #if defined(MAGIC_ENUM_USING_ALIAS_OPTIONAL) |
149 | | MAGIC_ENUM_USING_ALIAS_OPTIONAL |
150 | | #else |
151 | | using std::optional; |
152 | | #endif |
153 | | |
154 | | // If need another string_view type, define the macro MAGIC_ENUM_USING_ALIAS_STRING_VIEW. |
155 | | #if defined(MAGIC_ENUM_USING_ALIAS_STRING_VIEW) |
156 | | MAGIC_ENUM_USING_ALIAS_STRING_VIEW |
157 | | #else |
158 | | using std::string_view; |
159 | | #endif |
160 | | |
161 | | // If need another string type, define the macro MAGIC_ENUM_USING_ALIAS_STRING. |
162 | | #if defined(MAGIC_ENUM_USING_ALIAS_STRING) |
163 | | MAGIC_ENUM_USING_ALIAS_STRING |
164 | | #else |
165 | | using std::string; |
166 | | #endif |
167 | | |
168 | | using char_type = string_view::value_type; |
169 | | static_assert(std::is_same_v<string_view::value_type, string::value_type>, "magic_enum::customize requires same string_view::value_type and string::value_type"); |
170 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
171 | | static_assert(std::is_same_v<char_type, char> || std::is_same_v<char_type, wchar_t> || std::is_same_v<char_type, char8_t> || std::is_same_v<char_type, char16_t> || std::is_same_v<char_type, char32_t>, |
172 | | "magic_enum standard reflection requires string_view::value_type to be a standard character type; define MAGIC_ENUM_FORCE_COMPILER_SPECIFIC_REFLECTION before including magic_enum.hpp for other character types."); |
173 | | #endif |
174 | | static_assert([] { |
175 | | if constexpr (std::is_same_v<char_type, wchar_t>) { |
176 | | constexpr const char c[] = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789|"; |
177 | | constexpr const wchar_t wc[] = L"abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789|"; |
178 | | static_assert(std::size(c) == std::size(wc), "magic_enum::customize identifier characters are multichars in wchar_t."); |
179 | | |
180 | | for (std::size_t i = 0; i < std::size(c); ++i) { |
181 | | if (c[i] != wc[i]) { |
182 | | return false; |
183 | | } |
184 | | } |
185 | | } |
186 | | return true; |
187 | | }(), "magic_enum::customize wchar_t is not compatible with ASCII."); |
188 | | |
189 | | namespace customize { |
190 | | |
191 | | template <typename E, typename = void> |
192 | | struct enum_range; |
193 | | |
194 | | } // namespace magic_enum::customize |
195 | | |
196 | | namespace detail { |
197 | | |
198 | | template <typename E, typename = void> |
199 | | inline constexpr std::size_t prefix_length_v = 0; |
200 | | |
201 | | template <typename E> |
202 | | inline constexpr auto prefix_length_v<E, std::void_t<decltype(customize::enum_range<E>::prefix_length)>> = std::size_t{customize::enum_range<E>::prefix_length}; |
203 | | |
204 | 0 | constexpr bool valid_prefix_length(std::size_t prefix, std::size_t name_size) noexcept { |
205 | 0 | return prefix == 0 || prefix < name_size; |
206 | 0 | } |
207 | | |
208 | | } // namespace magic_enum::detail |
209 | | |
210 | | namespace customize { |
211 | | |
212 | | template <bool IsFlags = false, int Min = MAGIC_ENUM_RANGE_MIN, int Max = MAGIC_ENUM_RANGE_MAX, std::size_t PrefixLength = 0> |
213 | | struct adl_info_holder { |
214 | | static constexpr int min = Min; |
215 | | static constexpr int max = Max; |
216 | | static constexpr bool is_flags = IsFlags; |
217 | | static constexpr std::size_t prefix_length = PrefixLength; |
218 | | |
219 | | template <int NewMin, int NewMax> |
220 | | static constexpr adl_info_holder<IsFlags, NewMin, NewMax, PrefixLength> minmax() { return {}; } |
221 | | |
222 | | template <bool NewIsFlags> |
223 | | static constexpr adl_info_holder<NewIsFlags, Min, Max, PrefixLength> flag() { return {}; } |
224 | | |
225 | | template <std::size_t NewPrefixLength> |
226 | | static constexpr adl_info_holder<IsFlags, Min, Max, NewPrefixLength> prefix() { return {}; } |
227 | | }; |
228 | | |
229 | 0 | constexpr adl_info_holder<> adl_info() { return {}; } |
230 | | |
231 | | // Compiler-specific reflection scans common enum values in [min, max]. Redefine MAGIC_ENUM_RANGE_MIN/MAX globally or specialize enum_range for a specific enum. |
232 | | template <typename E, typename> |
233 | | struct enum_range { |
234 | | static constexpr int min = MAGIC_ENUM_RANGE_MIN; |
235 | | static constexpr int max = MAGIC_ENUM_RANGE_MAX; |
236 | | }; |
237 | | |
238 | | template <typename E> |
239 | | struct enum_range<E, decltype(void(magic_enum_define_range_adl(E{})))> : decltype(magic_enum_define_range_adl(E{})) {}; |
240 | | |
241 | | namespace detail { |
242 | | |
243 | | enum class customize_tag { |
244 | | default_tag, |
245 | | invalid_tag, |
246 | | custom_tag |
247 | | }; |
248 | | |
249 | | } // namespace magic_enum::customize::detail |
250 | | |
251 | | class customize_t : public std::pair<detail::customize_tag, string_view> { |
252 | | public: |
253 | 0 | constexpr customize_t(string_view srt) : std::pair<detail::customize_tag, string_view>{detail::customize_tag::custom_tag, srt} {} |
254 | 0 | constexpr customize_t(const char_type* srt) : customize_t{string_view{srt}} {} |
255 | 0 | constexpr customize_t(detail::customize_tag tag) : std::pair<detail::customize_tag, string_view>{tag, string_view{}} { |
256 | 0 | MAGIC_ENUM_ASSERT(tag != detail::customize_tag::custom_tag); |
257 | 0 | } |
258 | | }; |
259 | | |
260 | | // Default customize. |
261 | | inline constexpr auto default_tag = customize_t{detail::customize_tag::default_tag}; |
262 | | // Invalid customize. |
263 | | inline constexpr auto invalid_tag = customize_t{detail::customize_tag::invalid_tag}; |
264 | | |
265 | | // If need custom names for enum, add specialization enum_name for necessary enum type. |
266 | | template <typename E> |
267 | 0 | constexpr customize_t enum_name(E) noexcept { |
268 | 0 | return default_tag; |
269 | 0 | } |
270 | | |
271 | | // If need custom type name for enum, add specialization enum_type_name for necessary enum type. |
272 | | template <typename E> |
273 | | constexpr customize_t enum_type_name() noexcept { |
274 | | return default_tag; |
275 | | } |
276 | | |
277 | | } // namespace magic_enum::customize |
278 | | |
279 | | namespace detail { |
280 | | |
281 | | template <typename T> |
282 | | struct supported |
283 | | #if defined(MAGIC_ENUM_SUPPORTED) || defined(MAGIC_ENUM_NO_CHECK_SUPPORT) |
284 | | : std::true_type {}; |
285 | | #else |
286 | | : std::false_type {}; |
287 | | #endif |
288 | | |
289 | | template <auto V, typename E = std::decay_t<decltype(V)>, std::enable_if_t<std::is_enum_v<E>, int> = 0> |
290 | | using enum_constant = std::integral_constant<E, V>; |
291 | | |
292 | | template <typename... T> |
293 | | inline constexpr bool always_false_v = false; |
294 | | |
295 | | template <typename T, typename = void> |
296 | | struct has_is_flags : std::false_type {}; |
297 | | |
298 | | template <typename T> |
299 | | struct has_is_flags<T, std::void_t<decltype(customize::enum_range<T>::is_flags)>> : std::true_type { |
300 | | static_assert(std::is_same_v<bool, std::decay_t<decltype(customize::enum_range<T>::is_flags)>>, "magic_enum::customize::enum_range requires is_flags to have bool type."); |
301 | | }; |
302 | | |
303 | | template <typename T, typename = void> |
304 | | struct range_min : std::integral_constant<int, MAGIC_ENUM_RANGE_MIN> {}; |
305 | | |
306 | | template <typename T> |
307 | | struct range_min<T, std::void_t<decltype(customize::enum_range<T>::min)>> : std::integral_constant<decltype(customize::enum_range<T>::min), customize::enum_range<T>::min> {}; |
308 | | |
309 | | template <typename T, typename = void> |
310 | | struct range_max : std::integral_constant<int, MAGIC_ENUM_RANGE_MAX> {}; |
311 | | |
312 | | template <typename T> |
313 | | struct range_max<T, std::void_t<decltype(customize::enum_range<T>::max)>> : std::integral_constant<decltype(customize::enum_range<T>::max), customize::enum_range<T>::max> {}; |
314 | | |
315 | | struct cname_ref { |
316 | | const char* str_ = nullptr; |
317 | | std::size_t size_ = 0; |
318 | | }; |
319 | | |
320 | | template <typename E> |
321 | 16.5k | constexpr bool enum_value_equal(E lhs, E rhs) noexcept { |
322 | 16.5k | using U = std::underlying_type_t<E>; |
323 | 16.5k | return static_cast<U>(lhs) == static_cast<U>(rhs); |
324 | 16.5k | } |
325 | | |
326 | | template <typename E> |
327 | 21.7k | constexpr bool enum_value_equal(E lhs, std::underlying_type_t<E> rhs) noexcept { |
328 | 21.7k | return static_cast<std::underlying_type_t<E>>(lhs) == rhs; |
329 | 21.7k | } |
330 | | |
331 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
332 | | |
333 | | namespace reflection { |
334 | | |
335 | | template <typename E> |
336 | | consteval auto enumerators() noexcept { |
337 | | if constexpr (std::meta::is_enumerable_type(^^E)) { |
338 | | return std::define_static_array(std::meta::enumerators_of(^^E)); |
339 | | } else { |
340 | | static_assert(always_false_v<E>, "magic_enum requires a complete enum definition."); |
341 | | return std::array<std::meta::info, 0>{}; |
342 | | } |
343 | | } |
344 | | |
345 | | template <typename E> |
346 | | inline constexpr auto enumerators_v = enumerators<E>(); |
347 | | |
348 | | template <typename E> |
349 | | consteval auto type_name() noexcept { |
350 | | if constexpr (std::meta::has_identifier(^^E)) { |
351 | | constexpr auto identifier = std::meta::identifier_of(^^E); |
352 | | return cname_ref{identifier.data(), identifier.size()}; |
353 | | } else { |
354 | | return cname_ref{}; |
355 | | } |
356 | | } |
357 | | |
358 | | template <auto V, typename E = std::decay_t<decltype(V)>> |
359 | | consteval auto enum_name() noexcept { |
360 | | template for (constexpr auto enumerator : enumerators_v<E>) { |
361 | | if constexpr (enum_value_equal([:enumerator:], V)) { |
362 | | constexpr auto identifier = std::meta::identifier_of(enumerator); |
363 | | return cname_ref{identifier.data(), identifier.size()}; // Preserve one-name-per-value: first declaration wins. |
364 | | } |
365 | | } |
366 | | return cname_ref{}; |
367 | | } |
368 | | |
369 | | template <typename E> |
370 | | constexpr bool contains_underlying([[maybe_unused]] std::underlying_type_t<E> value) noexcept { |
371 | | template for (constexpr auto enumerator : enumerators_v<E>) { |
372 | | if (enum_value_equal([:enumerator:], value)) { |
373 | | return true; |
374 | | } |
375 | | } |
376 | | return false; |
377 | | } |
378 | | |
379 | | template <typename E> |
380 | | constexpr bool contains(E value) noexcept { |
381 | | return contains_underlying<E>(static_cast<std::underlying_type_t<E>>(value)); |
382 | | } |
383 | | |
384 | | } // namespace reflection |
385 | | |
386 | | #endif |
387 | | |
388 | | template <std::uint16_t N> |
389 | | class static_str { |
390 | | public: |
391 | | constexpr explicit static_str(cname_ref str) noexcept : static_str{str.str_, std::make_integer_sequence<std::uint16_t, N>{}} { |
392 | | MAGIC_ENUM_ASSERT(str.size_ == N); |
393 | | } |
394 | | |
395 | | constexpr explicit static_str(const char* const str) noexcept : static_str{str, std::make_integer_sequence<std::uint16_t, N>{}} {} |
396 | | |
397 | | constexpr explicit static_str(string_view str) noexcept : static_str{str.data(), std::make_integer_sequence<std::uint16_t, N>{}} { |
398 | | MAGIC_ENUM_ASSERT(str.size() == N); |
399 | | } |
400 | | |
401 | 0 | constexpr const char_type* data() const noexcept { return chars_; } |
402 | | |
403 | 0 | constexpr std::uint16_t size() const noexcept { return N; } |
404 | | |
405 | 0 | constexpr string_view str() const noexcept { return string_view(data(), size()); } |
406 | | |
407 | | char_type chars_[static_cast<std::size_t>(N) + 1]; |
408 | | |
409 | | private: |
410 | 0 | [[nodiscard]] static constexpr char_type to_char_type(char value) noexcept { |
411 | 0 | if constexpr (std::is_same_v<char_type, char>) { |
412 | 0 | return value; |
413 | 0 | } else { |
414 | 0 | return static_cast<char_type>(value); |
415 | 0 | } |
416 | 0 | } |
417 | | |
418 | | template <std::uint16_t... J> |
419 | | constexpr static_str(const char* str, std::integer_sequence<std::uint16_t, J...>) noexcept : chars_{to_char_type(str[J])..., char_type{}} {} |
420 | | |
421 | | template <std::uint16_t... J> |
422 | | constexpr static_str(string_view str, std::integer_sequence<std::uint16_t, J...>) noexcept : chars_{str[J]..., char_type{}} {} |
423 | | }; |
424 | | |
425 | | template <> |
426 | | class static_str<0> { |
427 | | public: |
428 | | constexpr static_str() noexcept = default; |
429 | | |
430 | 0 | constexpr static_str(cname_ref) noexcept {} |
431 | | |
432 | 0 | constexpr static_str(string_view) noexcept {} |
433 | | |
434 | 0 | constexpr const char_type* data() const noexcept { return chars_; } |
435 | | |
436 | 0 | constexpr std::uint16_t size() const noexcept { return 0; } |
437 | | |
438 | 0 | constexpr string_view str() const noexcept { return string_view(data(), size()); } |
439 | | |
440 | | static constexpr char_type chars_[1] = {}; |
441 | | }; |
442 | | |
443 | | template <typename Op = std::equal_to<>> |
444 | | class case_insensitive { |
445 | | static constexpr char_type to_lower(char_type c) noexcept { |
446 | | return (c >= char_type{'A'} && c <= char_type{'Z'}) ? static_cast<char_type>(c + (char_type{'a'} - char_type{'A'})) : c; |
447 | | } |
448 | | |
449 | | public: |
450 | | template <typename L, typename R> |
451 | | constexpr auto operator()(L lhs, R rhs) const noexcept -> std::enable_if_t<std::is_same_v<std::decay_t<L>, char_type> && std::is_same_v<std::decay_t<R>, char_type>, bool> { |
452 | | return Op{}(to_lower(lhs), to_lower(rhs)); |
453 | | } |
454 | | }; |
455 | | |
456 | 0 | constexpr std::size_t find(string_view str, char_type c) noexcept { |
457 | 0 | #if defined(__clang__) && __clang_major__ < 9 && defined(__GLIBCXX__) || defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) |
458 | 0 | // https://stackoverflow.com/questions/56484834/constexpr-stdstring-viewfind-last-of-doesnt-work-on-clang-8-with-libstdc |
459 | 0 | // https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html |
460 | 0 | constexpr bool workaround = true; |
461 | 0 | #else |
462 | 0 | constexpr bool workaround = false; |
463 | 0 | #endif |
464 | 0 |
|
465 | 0 | if constexpr (workaround) { |
466 | 0 | for (std::size_t i = 0; i < str.size(); ++i) { |
467 | 0 | if (str[i] == c) { |
468 | 0 | return i; |
469 | 0 | } |
470 | 0 | } |
471 | 0 |
|
472 | 0 | return string_view::npos; |
473 | 0 | } else { |
474 | 0 | return str.find(c); |
475 | 0 | } |
476 | 0 | } |
477 | | |
478 | | template <typename BinaryPredicate> |
479 | | inline constexpr bool is_default_predicate_v = std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<string_view::value_type>> || std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<>>; |
480 | | |
481 | | template <typename BinaryPredicate> |
482 | | inline constexpr bool is_nothrow_invocable_v = is_default_predicate_v<BinaryPredicate> || std::is_nothrow_invocable_r_v<bool, BinaryPredicate&, char_type, char_type>; |
483 | | |
484 | | template <typename BinaryPredicate> |
485 | 21.7k | constexpr bool cmp_equal(string_view lhs, string_view rhs, [[maybe_unused]] BinaryPredicate&& p) noexcept(is_nothrow_invocable_v<BinaryPredicate>) { |
486 | | #if defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) |
487 | | // https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html |
488 | | // https://developercommunity.visualstudio.com/content/problem/232218/c-constexpr-string-view.html |
489 | | constexpr bool workaround = true; |
490 | | #else |
491 | 21.7k | constexpr bool workaround = false; |
492 | 21.7k | #endif |
493 | | |
494 | | if constexpr (!is_default_predicate_v<BinaryPredicate> || workaround) { |
495 | | if (lhs.size() != rhs.size()) { |
496 | | return false; |
497 | | } |
498 | | |
499 | | const auto size = lhs.size(); |
500 | | for (std::size_t i = 0; i < size; ++i) { |
501 | | if (!p(lhs[i], rhs[i])) { |
502 | | return false; |
503 | | } |
504 | | } |
505 | | |
506 | | return true; |
507 | 21.7k | } else { |
508 | 21.7k | return lhs == rhs; |
509 | 21.7k | } |
510 | 21.7k | } |
511 | | |
512 | | template <typename L, typename R> |
513 | 0 | constexpr bool cmp_less(L lhs, R rhs) noexcept { |
514 | 0 | static_assert(std::is_integral_v<L> && std::is_integral_v<R>, "magic_enum::detail::cmp_less requires integral type."); |
515 | 0 |
|
516 | 0 | if constexpr (std::is_same_v<L, bool> && std::is_same_v<R, bool>) { |
517 | 0 | return static_cast<unsigned char>(lhs) < static_cast<unsigned char>(rhs); |
518 | 0 | } else if constexpr (std::is_same_v<L, bool>) { |
519 | 0 | return static_cast<R>(lhs) < rhs; |
520 | 0 | } else if constexpr (std::is_same_v<R, bool>) { |
521 | 0 | return lhs < static_cast<L>(rhs); |
522 | 0 | } else if constexpr (std::is_signed_v<L> == std::is_signed_v<R>) { |
523 | 0 | return lhs < rhs; |
524 | 0 | } else if constexpr (std::is_signed_v<R>) { |
525 | 0 | using C = std::common_type_t<std::make_unsigned_t<L>, std::make_unsigned_t<R>>; |
526 | 0 | return rhs > 0 && static_cast<C>(lhs) < static_cast<C>(rhs); |
527 | 0 | } else { |
528 | 0 | using C = std::common_type_t<std::make_unsigned_t<L>, std::make_unsigned_t<R>>; |
529 | 0 | return lhs < 0 || static_cast<C>(lhs) < static_cast<C>(rhs); |
530 | 0 | } |
531 | 0 | } |
532 | | |
533 | | template <typename T> |
534 | | using make_unsigned_t = std::make_unsigned_t<std::conditional_t<std::is_same_v<T, bool>, unsigned char, T>>; |
535 | | |
536 | | template <typename T> |
537 | | constexpr T log2(T value) noexcept { |
538 | | static_assert(std::is_integral_v<T>, "magic_enum::detail::log2 requires integral type."); |
539 | | |
540 | | auto ret = T{0}; |
541 | | for (; value > T{1}; value >>= T{1}, ++ret) {} |
542 | | |
543 | | return ret; |
544 | | } |
545 | | |
546 | | #if defined(__cpp_lib_array_constexpr) && __cpp_lib_array_constexpr >= 201603L |
547 | | # define MAGIC_ENUM_ARRAY_CONSTEXPR 1 |
548 | | #else |
549 | | template <typename T, std::size_t N, std::size_t... J> |
550 | | constexpr std::array<std::remove_cv_t<T>, N> to_array(T(&a)[N], std::index_sequence<J...>) noexcept { |
551 | | return {{a[J]...}}; |
552 | | } |
553 | | #endif |
554 | | |
555 | | template <typename T> |
556 | | inline constexpr bool is_enum_v = std::is_enum_v<T> && std::is_same_v<T, std::decay_t<T>>; |
557 | | |
558 | | template <typename E> |
559 | | constexpr auto MAGIC_ENUM_CALLING_CONVENTION n() noexcept { |
560 | | static_assert(is_enum_v<E>, "magic_enum::detail::n requires enum type."); |
561 | | |
562 | | if constexpr (supported<E>::value) { |
563 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
564 | | auto name = reflection::type_name<E>(); |
565 | | #elif defined(MAGIC_ENUM_GET_TYPE_NAME_BUILTIN) |
566 | | constexpr auto name_ptr = MAGIC_ENUM_GET_TYPE_NAME_BUILTIN(E); |
567 | | constexpr auto name = name_ptr ? cname_ref{name_ptr, std::char_traits<char>::length(name_ptr)} : cname_ref{}; |
568 | | #elif defined(__clang__) |
569 | | cname_ref name; |
570 | | if constexpr (sizeof(__PRETTY_FUNCTION__) == sizeof(__FUNCTION__)) { |
571 | | static_assert(always_false_v<E>, "magic_enum::detail::n requires __PRETTY_FUNCTION__."); |
572 | | return cname_ref{}; |
573 | | } else { |
574 | | name.size_ = sizeof(__PRETTY_FUNCTION__) - 36; |
575 | | name.str_ = __PRETTY_FUNCTION__ + 34; |
576 | | } |
577 | | #elif defined(__GNUC__) |
578 | | auto name = cname_ref{__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__) - 1}; |
579 | | if constexpr (sizeof(__PRETTY_FUNCTION__) == sizeof(__FUNCTION__)) { |
580 | | static_assert(always_false_v<E>, "magic_enum::detail::n requires __PRETTY_FUNCTION__."); |
581 | | return cname_ref{}; |
582 | | } else if (name.str_[name.size_ - 1] == ']') { |
583 | | name.size_ -= 50; |
584 | | name.str_ += 49; |
585 | | } else { |
586 | | name.size_ -= 40; |
587 | | name.str_ += 37; |
588 | | } |
589 | | #elif defined(_MSC_VER) |
590 | | // CLI/C++ workaround (see https://github.com/Neargye/magic_enum/issues/284). |
591 | | cname_ref name; |
592 | | name.str_ = __FUNCSIG__; |
593 | | name.str_ += 40; |
594 | | name.size_ += sizeof(__FUNCSIG__) - 57; |
595 | | #else |
596 | | auto name = cname_ref{}; |
597 | | #endif |
598 | | #if !defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
599 | | std::size_t p = 0; |
600 | | for (std::size_t i = name.size_; i > 0; --i) { |
601 | | if (name.str_[i] == ':') { |
602 | | p = i + 1; |
603 | | break; |
604 | | } |
605 | | } |
606 | | if (p > 0) { |
607 | | name.size_ -= p; |
608 | | name.str_ += p; |
609 | | } |
610 | | #endif |
611 | | return name; |
612 | | } else { |
613 | | return cname_ref{}; // Unsupported compiler or Invalid customize. |
614 | | } |
615 | | } |
616 | | |
617 | | template <typename E> |
618 | | constexpr auto type_name() noexcept { |
619 | | [[maybe_unused]] constexpr auto custom = customize::enum_type_name<E>(); |
620 | | static_assert(std::is_same_v<std::decay_t<decltype(custom)>, customize::customize_t>, "magic_enum::customize requires customize_t type."); |
621 | | if constexpr (custom.first == customize::detail::customize_tag::custom_tag) { |
622 | | constexpr auto name = custom.second; |
623 | | static_assert(!name.empty(), "magic_enum::customize requires not empty string."); |
624 | | return static_str<name.size()>{name}; |
625 | | } else if constexpr (custom.first == customize::detail::customize_tag::invalid_tag) { |
626 | | return static_str<0>{}; |
627 | | } else if constexpr (custom.first == customize::detail::customize_tag::default_tag) { |
628 | | constexpr auto name = n<E>(); |
629 | | return static_str<name.size_>{name}; |
630 | | } else { |
631 | | static_assert(always_false_v<E>, "magic_enum::customize invalid."); |
632 | | } |
633 | | } |
634 | | |
635 | | template <typename E> |
636 | | inline constexpr auto type_name_v = type_name<E>(); |
637 | | |
638 | | template <auto V> |
639 | 0 | constexpr auto MAGIC_ENUM_CALLING_CONVENTION n() noexcept { |
640 | 0 | static_assert(is_enum_v<decltype(V)>, "magic_enum::detail::n requires enum type."); |
641 | 0 |
|
642 | 0 | if constexpr (supported<decltype(V)>::value) { |
643 | 0 | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
644 | 0 | auto name = reflection::enum_name<V>(); |
645 | 0 | #elif defined(MAGIC_ENUM_GET_ENUM_NAME_BUILTIN) |
646 | 0 | constexpr auto name_ptr = MAGIC_ENUM_GET_ENUM_NAME_BUILTIN(V); |
647 | 0 | auto name = name_ptr ? cname_ref{name_ptr, std::char_traits<char>::length(name_ptr)} : cname_ref{}; |
648 | 0 | #elif defined(__clang__) |
649 | 0 | cname_ref name; |
650 | 0 | if constexpr (sizeof(__PRETTY_FUNCTION__) == sizeof(__FUNCTION__)) { |
651 | 0 | static_assert(always_false_v<decltype(V)>, "magic_enum::detail::n requires __PRETTY_FUNCTION__."); |
652 | 0 | return cname_ref{}; |
653 | 0 | } else { |
654 | 0 | name.size_ = sizeof(__PRETTY_FUNCTION__) - 36; |
655 | 0 | name.str_ = __PRETTY_FUNCTION__ + 34; |
656 | 0 | } |
657 | 0 | if (name.size_ > 22 && name.str_[0] == '(' && name.str_[1] == 'a' && name.str_[10] == ' ' && name.str_[22] == ':') { |
658 | 0 | name.size_ -= 23; |
659 | 0 | name.str_ += 23; |
660 | 0 | } |
661 | 0 | if (name.str_[0] == '(' || name.str_[0] == '-' || (name.str_[0] >= '0' && name.str_[0] <= '9')) { |
662 | 0 | name = cname_ref{}; |
663 | 0 | } |
664 | 0 | #elif defined(__GNUC__) |
665 | 0 | auto name = cname_ref{__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__) - 1}; |
666 | 0 | if constexpr (sizeof(__PRETTY_FUNCTION__) == sizeof(__FUNCTION__)) { |
667 | 0 | static_assert(always_false_v<decltype(V)>, "magic_enum::detail::n requires __PRETTY_FUNCTION__."); |
668 | 0 | return cname_ref{}; |
669 | 0 | } else if (name.str_[name.size_ - 1] == ']') { |
670 | 0 | name.size_ -= 55; |
671 | 0 | name.str_ += 54; |
672 | 0 | } else { |
673 | 0 | name.size_ -= 40; |
674 | 0 | name.str_ += 37; |
675 | 0 | } |
676 | 0 | if (name.str_[0] == '(') { |
677 | 0 | name = cname_ref{}; |
678 | 0 | } |
679 | 0 | #elif defined(_MSC_VER) |
680 | 0 | cname_ref name; |
681 | 0 | if ((__FUNCSIG__[5] == '_' && __FUNCSIG__[35] != '(') || (__FUNCSIG__[5] == 'c' && __FUNCSIG__[41] != '(')) { |
682 | 0 | // CLI/C++ workaround (see https://github.com/Neargye/magic_enum/issues/284). |
683 | 0 | name.str_ = __FUNCSIG__; |
684 | 0 | name.str_ += 35; |
685 | 0 | name.size_ = sizeof(__FUNCSIG__) - 52; |
686 | 0 | } |
687 | 0 | #else |
688 | 0 | auto name = cname_ref{}; |
689 | 0 | #endif |
690 | 0 | #if !defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
691 | 0 | std::size_t p = 0; |
692 | 0 | for (std::size_t i = name.size_; i > 0; --i) { |
693 | 0 | if (name.str_[i] == ':') { |
694 | 0 | p = i + 1; |
695 | 0 | break; |
696 | 0 | } |
697 | 0 | } |
698 | 0 | if (p > 0) { |
699 | 0 | name.size_ -= p; |
700 | 0 | name.str_ += p; |
701 | 0 | } |
702 | 0 | #endif |
703 | 0 | return name; |
704 | 0 | } else { |
705 | 0 | return cname_ref{}; // Unsupported compiler or Invalid customize. |
706 | 0 | } |
707 | 0 | } Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn128EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn127EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn126EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn125EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn124EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn123EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn122EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn121EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn120EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn119EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn118EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn117EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn116EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn115EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn114EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn113EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn112EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn111EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn110EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn109EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn108EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn107EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn106EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn105EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn104EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn103EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn102EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn101EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn100EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn99EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn98EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn97EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn96EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn95EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn94EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn93EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn92EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn91EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn90EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn89EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn88EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn87EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn86EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn85EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn84EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn83EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn82EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn81EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn80EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn79EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn78EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn77EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn76EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn75EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn74EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn73EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn72EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn71EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn70EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn69EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn68EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn67EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn66EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn65EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn64EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn63EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn62EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn61EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn60EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn59EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn58EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn57EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn56EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn55EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn54EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn53EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn52EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn51EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn50EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn49EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn48EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn47EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn46EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn45EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn44EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn43EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn42EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn41EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn40EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn39EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn38EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn37EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn36EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn35EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn34EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn33EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn32EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn31EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn30EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn29EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn28EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn27EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn26EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn25EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn24EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn23EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn22EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn21EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn20EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn19EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn18EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn17EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn16EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn15EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn14EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn13EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn12EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn11EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn10EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn9EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn8EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn7EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn6EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn5EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn4EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn3EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn2EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnumn1EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum0EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum1EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum2EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum3EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum4EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum5EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum6EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum7EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum8EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum9EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum10EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum11EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum12EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum13EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum14EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum15EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum16EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum17EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum18EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum19EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum20EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum21EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum22EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum23EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum24EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum25EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum26EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum27EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum28EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum29EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum30EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum31EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum32EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum33EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum34EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum35EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum36EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum37EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum38EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum39EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum40EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum41EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum42EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum43EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum44EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum45EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum46EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum47EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum48EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum49EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum50EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum51EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum52EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum53EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum54EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum55EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum56EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum57EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum58EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum59EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum60EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum61EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum62EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum63EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum64EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum65EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum66EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum67EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum68EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum69EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum70EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum71EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum72EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum73EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum74EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum75EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum76EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum77EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum78EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum79EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum80EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum81EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum82EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum83EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum84EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum85EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum86EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum87EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum88EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum89EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum90EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum91EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum92EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum93EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum94EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum95EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum96EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum97EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum98EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum99EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum100EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum101EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum102EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum103EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum104EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum105EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum106EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum107EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum108EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum109EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum110EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum111EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum112EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum113EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum114EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum115EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum116EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum117EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum118EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum119EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum120EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum121EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum122EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum123EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum124EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum125EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum126EEEDav Unexecuted instantiation: _ZN10magic_enum6detail1nITnDaLZ22LLVMFuzzerTestOneInputE8FuzzEnum127EEEDav |
708 | | |
709 | | #if defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1920 |
710 | | # define MAGIC_ENUM_VS_2017_WORKAROUND 1 |
711 | | #endif |
712 | | |
713 | | #if defined(MAGIC_ENUM_VS_2017_WORKAROUND) |
714 | | template <typename E, E V> |
715 | | constexpr auto MAGIC_ENUM_CALLING_CONVENTION n() noexcept { |
716 | | static_assert(is_enum_v<E>, "magic_enum::detail::n requires enum type."); |
717 | | |
718 | | # if defined(MAGIC_ENUM_GET_ENUM_NAME_BUILTIN) |
719 | | constexpr auto name_ptr = MAGIC_ENUM_GET_ENUM_NAME_BUILTIN(V); |
720 | | auto name = name_ptr ? cname_ref{name_ptr, std::char_traits<char>::length(name_ptr)} : cname_ref{}; |
721 | | # else |
722 | | // CLI/C++ workaround (see https://github.com/Neargye/magic_enum/issues/284). |
723 | | cname_ref name; |
724 | | name.str_ = __FUNCSIG__; |
725 | | name.size_ = sizeof(__FUNCSIG__) - 1; |
726 | | while (name.size_ > 0 && name.str_[name.size_ - 1] != '>') { |
727 | | --name.size_; |
728 | | } |
729 | | if (name.size_ > 0) { |
730 | | --name.size_; |
731 | | } |
732 | | std::size_t p = 0, depth = 0; |
733 | | for (std::size_t i = name.size_; i > 0; --i) { |
734 | | if (name.str_[i - 1] == '>') { |
735 | | ++depth; |
736 | | } else if (name.str_[i - 1] == '<' && depth > 0) { |
737 | | --depth; |
738 | | } else if (name.str_[i - 1] == ',' && depth == 0) { |
739 | | p = i; |
740 | | break; |
741 | | } |
742 | | } |
743 | | if (p > 0) { |
744 | | name.size_ -= p; |
745 | | name.str_ += p; |
746 | | } |
747 | | if (name.str_[0] == '(' || name.str_[0] == '-' || (name.str_[0] >= '0' && name.str_[0] <= '9')) { |
748 | | name = cname_ref{}; |
749 | | } else { |
750 | | for (std::size_t i = name.size_; i > 0; --i) { |
751 | | if (name.str_[i - 1] == ':') { |
752 | | name.size_ -= i; |
753 | | name.str_ += i; |
754 | | break; |
755 | | } |
756 | | } |
757 | | } |
758 | | return name; |
759 | | # endif |
760 | | } |
761 | | #endif |
762 | | |
763 | | template <typename E, E V> |
764 | 0 | constexpr auto enum_name() noexcept { |
765 | 0 | [[maybe_unused]] constexpr auto custom = customize::enum_name<E>(V); |
766 | 0 | static_assert(std::is_same_v<std::decay_t<decltype(custom)>, customize::customize_t>, "magic_enum::customize requires customize_t type."); |
767 | 0 | if constexpr (custom.first == customize::detail::customize_tag::custom_tag) { |
768 | 0 | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
769 | 0 | static_assert(reflection::contains<E>(V), "magic_enum::customize::enum_name cannot add an undeclared enum value when standard reflection is enabled."); |
770 | 0 | #endif |
771 | 0 | constexpr auto name = custom.second; |
772 | 0 | static_assert(!name.empty(), "magic_enum::customize requires not empty string."); |
773 | 0 | return static_str<name.size()>{name}; |
774 | 0 | } else if constexpr (custom.first == customize::detail::customize_tag::invalid_tag) { |
775 | 0 | return static_str<0>{}; |
776 | 0 | } else if constexpr (custom.first == customize::detail::customize_tag::default_tag) { |
777 | 0 | #if defined(MAGIC_ENUM_VS_2017_WORKAROUND) |
778 | 0 | constexpr auto name = n<E, V>(); |
779 | 0 | #else |
780 | 0 | constexpr auto name = n<V>(); |
781 | 0 | #endif |
782 | 0 | constexpr auto prefix = prefix_length_v<E>; |
783 | 0 | constexpr bool valid_prefix = valid_prefix_length(prefix, name.size_); |
784 | 0 | static_assert(valid_prefix, "magic_enum::customize requires valid prefix length."); |
785 | 0 | if constexpr (valid_prefix) { |
786 | 0 | return static_str<name.size_ - prefix>{name.str_ + prefix}; |
787 | 0 | } else { |
788 | 0 | return static_str<0>{}; |
789 | 0 | } |
790 | 0 | } else { |
791 | 0 | static_assert(always_false_v<E>, "magic_enum::customize invalid."); |
792 | 0 | } |
793 | 0 | } Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_n5EEEDav Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_0EEEDav Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_10EEEDav Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_11EEEDav Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_12EEEDav Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_13EEEDav Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail9enum_nameIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnT_LS2_14EEEDav |
794 | | |
795 | | template <typename E, E V> |
796 | | inline constexpr auto enum_name_v = enum_name<E, V>(); |
797 | | |
798 | | // CWG1766: Values outside the range of the values of an enumeration |
799 | | // https://reviews.llvm.org/D130058, https://reviews.llvm.org/D131307 |
800 | | #if defined(__clang__) && __clang_major__ >= 16 |
801 | | template <typename E, auto V, typename = void> |
802 | | inline constexpr bool is_enum_constexpr_static_cast_valid = false; |
803 | | template <typename E, auto V> |
804 | | inline constexpr bool is_enum_constexpr_static_cast_valid<E, V, std::void_t<std::integral_constant<E, static_cast<E>(V)>>> = true; |
805 | | #else |
806 | | template <typename, auto> |
807 | | inline constexpr bool is_enum_constexpr_static_cast_valid = true; |
808 | | #endif |
809 | | |
810 | | template <typename E, auto V> |
811 | 0 | constexpr bool is_valid() noexcept { |
812 | 0 | if constexpr (is_enum_constexpr_static_cast_valid<E, V>) { |
813 | 0 | constexpr E v = static_cast<E>(V); |
814 | 0 | [[maybe_unused]] constexpr auto custom = customize::enum_name<E>(v); |
815 | 0 | static_assert(std::is_same_v<std::decay_t<decltype(custom)>, customize::customize_t>, "magic_enum::customize requires customize_t type."); |
816 | 0 | if constexpr (custom.first == customize::detail::customize_tag::custom_tag) { |
817 | 0 | constexpr auto name = custom.second; |
818 | 0 | static_assert(!name.empty(), "magic_enum::customize requires not empty string."); |
819 | 0 | return name.size() != 0; |
820 | 0 | } else if constexpr (custom.first == customize::detail::customize_tag::default_tag) { |
821 | 0 | #if defined(MAGIC_ENUM_VS_2017_WORKAROUND) |
822 | 0 | return n<E, v>().size_ != 0; |
823 | 0 | #else |
824 | 0 | return n<v>().size_ != 0; |
825 | 0 | #endif |
826 | 0 | } else { |
827 | 0 | return false; |
828 | 0 | } |
829 | 0 | } else { |
830 | 0 | return false; |
831 | 0 | } |
832 | 0 | } Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin128EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin127EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin126EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin125EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin124EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin123EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin122EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin121EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin120EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin119EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin118EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin117EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin116EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin115EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin114EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin113EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin112EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin111EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin110EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin109EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin108EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin107EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin106EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin105EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin104EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin103EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin102EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin101EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin100EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin99EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin98EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin97EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin96EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin95EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin94EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin93EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin92EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin91EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin90EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin89EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin88EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin87EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin86EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin85EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin84EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin83EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin82EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin81EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin80EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin79EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin78EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin77EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin76EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin75EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin74EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin73EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin72EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin71EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin70EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin69EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin68EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin67EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin66EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin65EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin64EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin63EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin62EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin61EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin60EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin59EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin58EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin57EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin56EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin55EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin54EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin53EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin52EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin51EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin50EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin49EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin48EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin47EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin46EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin45EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin44EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin43EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin42EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin41EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin40EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin39EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin38EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin37EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin36EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin35EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin34EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin33EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin32EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin31EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin30EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin29EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin28EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin27EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin26EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin25EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin24EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin23EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin22EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin21EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin20EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin19EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin18EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin17EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin16EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin15EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin14EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin13EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin12EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin11EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin10EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin9EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin8EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin7EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin6EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin5EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin4EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin3EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin2EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLin1EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi0EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi1EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi2EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi3EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi4EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi5EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi6EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi7EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi8EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi9EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi10EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi11EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi12EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi13EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi14EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi15EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi16EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi17EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi18EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi19EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi20EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi21EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi22EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi23EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi24EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi25EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi26EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi27EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi28EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi29EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi30EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi31EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi32EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi33EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi34EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi35EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi36EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi37EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi38EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi39EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi40EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi41EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi42EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi43EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi44EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi45EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi46EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi47EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi48EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi49EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi50EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi51EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi52EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi53EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi54EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi55EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi56EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi57EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi58EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi59EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi60EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi61EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi62EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi63EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi64EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi65EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi66EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi67EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi68EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi69EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi70EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi71EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi72EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi73EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi74EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi75EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi76EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi77EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi78EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi79EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi80EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi81EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi82EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi83EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi84EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi85EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi86EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi87EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi88EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi89EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi90EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi91EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi92EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi93EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi94EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi95EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi96EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi97EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi98EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi99EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi100EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi101EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi102EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi103EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi104EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi105EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi106EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi107EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi108EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi109EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi110EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi111EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi112EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi113EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi114EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi115EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi116EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi117EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi118EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi119EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi120EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi121EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi122EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi123EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi124EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi125EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi126EEEbv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum6detail8is_validIZ22LLVMFuzzerTestOneInputE8FuzzEnumTnDaLi127EEEbv |
833 | | |
834 | | enum class enum_subtype { |
835 | | common, |
836 | | flags |
837 | | }; |
838 | | |
839 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
840 | | |
841 | | namespace reflection { |
842 | | |
843 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
844 | | constexpr bool value_valid(E value) noexcept { |
845 | | if constexpr (S == enum_subtype::common) { |
846 | | return true; |
847 | | } else { |
848 | | const auto integer = static_cast<U>(value); |
849 | | if constexpr (std::is_signed_v<U>) { |
850 | | if (integer <= 0) { |
851 | | return false; |
852 | | } |
853 | | } |
854 | | using V = make_unsigned_t<U>; |
855 | | const auto flag = static_cast<V>(integer); |
856 | | return flag != V{0} && (flag & (flag - V{1})) == V{0}; |
857 | | } |
858 | | } |
859 | | |
860 | | struct name_ref { |
861 | | const char_type* data = nullptr; |
862 | | std::size_t size = 0; |
863 | | |
864 | | [[nodiscard]] constexpr string_view view() const noexcept { return {data, size}; } |
865 | | }; |
866 | | |
867 | | template <typename E> |
868 | | struct entry { |
869 | | E value{}; |
870 | | name_ref name{}; |
871 | | std::size_t declaration_index = 0; |
872 | | }; |
873 | | |
874 | | template <typename E, std::size_t N> |
875 | | struct table { |
876 | | std::array<entry<E>, N> entries{}; |
877 | | std::size_t size = 0; |
878 | | bool prefixes_valid = true; |
879 | | }; |
880 | | |
881 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
882 | | consteval auto canonical_data() noexcept { |
883 | | table<E, enumerators_v<E>.size()> result{}; |
884 | | constexpr auto prefix = prefix_length_v<E>; |
885 | | [[maybe_unused]] std::size_t declaration_index = 0; |
886 | | |
887 | | template for (constexpr auto enumerator : enumerators_v<E>) { |
888 | | constexpr E value = [:enumerator:]; |
889 | | if constexpr (value_valid<E, S>(value)) { |
890 | | constexpr auto custom = customize::enum_name<E>(value); |
891 | | static_assert(std::is_same_v<std::decay_t<decltype(custom)>, customize::customize_t>, "magic_enum::customize requires customize_t type."); |
892 | | |
893 | | if constexpr (custom.first == customize::detail::customize_tag::custom_tag) { |
894 | | constexpr auto name = custom.second; |
895 | | static_assert(!name.empty(), "magic_enum::customize requires not empty string."); |
896 | | constexpr auto persistent_name = std::define_static_string(std::span{name.data(), name.size()}); |
897 | | result.entries[result.size++] = entry<E>{value, {persistent_name, name.size()}, declaration_index}; |
898 | | } else if constexpr (custom.first == customize::detail::customize_tag::invalid_tag) { |
899 | | // An invalid customization removes this declared enumerator from the public tables. |
900 | | } else if constexpr (custom.first == customize::detail::customize_tag::default_tag) { |
901 | | constexpr auto identifier = std::meta::identifier_of(enumerator); |
902 | | if constexpr (valid_prefix_length(prefix, identifier.size())) { |
903 | | if constexpr (std::is_same_v<char_type, char>) { |
904 | | constexpr auto persistent_name = std::define_static_string(identifier.substr(prefix)); |
905 | | result.entries[result.size++] = entry<E>{value, {persistent_name, identifier.size() - prefix}, declaration_index}; |
906 | | } else { |
907 | | constexpr auto converted_name = [=] { |
908 | | std::array<char_type, identifier.size() - prefix> name{}; |
909 | | for (std::size_t i = 0; i < name.size(); ++i) { |
910 | | name[i] = static_cast<char_type>(identifier[i + prefix]); |
911 | | } |
912 | | return name; |
913 | | }(); |
914 | | constexpr auto persistent_name = std::define_static_string(converted_name); |
915 | | result.entries[result.size++] = entry<E>{value, {persistent_name, converted_name.size()}, declaration_index}; |
916 | | } |
917 | | } else { |
918 | | result.entries[result.size++] = entry<E>{value, {}, declaration_index}; |
919 | | } |
920 | | } else { |
921 | | static_assert(always_false_v<E>, "magic_enum::customize invalid."); |
922 | | } |
923 | | } |
924 | | ++declaration_index; |
925 | | } |
926 | | |
927 | | const auto less = [](const auto& lhs, const auto& rhs) { |
928 | | const auto lhs_value = static_cast<U>(lhs.value); |
929 | | const auto rhs_value = static_cast<U>(rhs.value); |
930 | | if (lhs_value != rhs_value) { |
931 | | return lhs_value < rhs_value; |
932 | | } |
933 | | return lhs.declaration_index < rhs.declaration_index; |
934 | | }; |
935 | | const auto first = result.entries.begin(); |
936 | | const auto last = first + result.size; |
937 | | if (!std::is_sorted(first, last, less)) { |
938 | | std::sort(first, last, less); |
939 | | } |
940 | | |
941 | | // Valid reflected names are non-empty, so an empty name marks an invalid prefix on the retained declaration. |
942 | | std::size_t unique_size = 0; |
943 | | for (std::size_t i = 0; i < result.size; ++i) { |
944 | | if (unique_size == 0 || !enum_value_equal(result.entries[unique_size - 1].value, result.entries[i].value)) { |
945 | | result.prefixes_valid = result.prefixes_valid && result.entries[i].name.size != 0; |
946 | | if (unique_size != i) { |
947 | | result.entries[unique_size] = result.entries[i]; |
948 | | } |
949 | | ++unique_size; |
950 | | } |
951 | | } |
952 | | result.size = unique_size; |
953 | | return result; |
954 | | } |
955 | | |
956 | | template <typename E, enum_subtype S> |
957 | | inline constexpr auto table_v = canonical_data<E, S>(); |
958 | | |
959 | | template <typename E, enum_subtype S> |
960 | | consteval std::size_t table_size() noexcept { |
961 | | static_assert(table_v<E, S>.prefixes_valid, "magic_enum::customize requires valid prefix length."); |
962 | | return table_v<E, S>.size; |
963 | | } |
964 | | |
965 | | } // namespace reflection |
966 | | |
967 | | #endif |
968 | | |
969 | | template <typename E, int O, enum_subtype S, typename U = std::underlying_type_t<E>> |
970 | 0 | constexpr U ualue(std::size_t i) noexcept { |
971 | 0 | if constexpr (S == enum_subtype::flags) { |
972 | 0 | using V = make_unsigned_t<U>; |
973 | 0 | const auto shifted = V{1} << static_cast<V>(static_cast<int>(i) + O); |
974 | 0 | return static_cast<U>(shifted); |
975 | 0 | } else { |
976 | 0 | return static_cast<U>(static_cast<int>(i) + O); |
977 | 0 | } |
978 | 0 | } |
979 | | |
980 | | template <typename E, int O, enum_subtype S, typename U = std::underlying_type_t<E>> |
981 | 0 | constexpr E value(std::size_t i) noexcept { |
982 | 0 | return static_cast<E>(ualue<E, O, S>(i)); |
983 | 0 | } |
984 | | |
985 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
986 | 0 | constexpr int reflected_min() noexcept { |
987 | 0 | if constexpr (S == enum_subtype::flags) { |
988 | 0 | return 0; |
989 | 0 | } else { |
990 | 0 | constexpr auto lhs = range_min<E>::value; |
991 | 0 | constexpr auto rhs = (std::numeric_limits<U>::min)(); |
992 | 0 |
|
993 | 0 | if constexpr (cmp_less(rhs, lhs)) { |
994 | 0 | return lhs; |
995 | 0 | } else { |
996 | 0 | return rhs; |
997 | 0 | } |
998 | 0 | } |
999 | 0 | } |
1000 | | |
1001 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1002 | 0 | constexpr int reflected_max() noexcept { |
1003 | 0 | if constexpr (S == enum_subtype::flags) { |
1004 | 0 | return std::numeric_limits<U>::digits - 1; |
1005 | 0 | } else { |
1006 | 0 | constexpr auto lhs = range_max<E>::value; |
1007 | 0 | constexpr auto rhs = (std::numeric_limits<U>::max)(); |
1008 | 0 |
|
1009 | 0 | if constexpr (cmp_less(lhs, rhs)) { |
1010 | 0 | return lhs; |
1011 | 0 | } else { |
1012 | 0 | return rhs; |
1013 | 0 | } |
1014 | 0 | } |
1015 | 0 | } |
1016 | | |
1017 | | #define MAGIC_ENUM_FOR_EACH_256(T) \ |
1018 | | 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) \ |
1019 | | T( 32)T( 33)T( 34)T( 35)T( 36)T( 37)T( 38)T( 39)T( 40)T( 41)T( 42)T( 43)T( 44)T( 45)T( 46)T( 47)T( 48)T( 49)T( 50)T( 51)T( 52)T( 53)T( 54)T( 55)T( 56)T( 57)T( 58)T( 59)T( 60)T( 61)T( 62)T( 63) \ |
1020 | | T( 64)T( 65)T( 66)T( 67)T( 68)T( 69)T( 70)T( 71)T( 72)T( 73)T( 74)T( 75)T( 76)T( 77)T( 78)T( 79)T( 80)T( 81)T( 82)T( 83)T( 84)T( 85)T( 86)T( 87)T( 88)T( 89)T( 90)T( 91)T( 92)T( 93)T( 94)T( 95) \ |
1021 | | T( 96)T( 97)T( 98)T( 99)T(100)T(101)T(102)T(103)T(104)T(105)T(106)T(107)T(108)T(109)T(110)T(111)T(112)T(113)T(114)T(115)T(116)T(117)T(118)T(119)T(120)T(121)T(122)T(123)T(124)T(125)T(126)T(127) \ |
1022 | | T(128)T(129)T(130)T(131)T(132)T(133)T(134)T(135)T(136)T(137)T(138)T(139)T(140)T(141)T(142)T(143)T(144)T(145)T(146)T(147)T(148)T(149)T(150)T(151)T(152)T(153)T(154)T(155)T(156)T(157)T(158)T(159) \ |
1023 | | T(160)T(161)T(162)T(163)T(164)T(165)T(166)T(167)T(168)T(169)T(170)T(171)T(172)T(173)T(174)T(175)T(176)T(177)T(178)T(179)T(180)T(181)T(182)T(183)T(184)T(185)T(186)T(187)T(188)T(189)T(190)T(191) \ |
1024 | | T(192)T(193)T(194)T(195)T(196)T(197)T(198)T(199)T(200)T(201)T(202)T(203)T(204)T(205)T(206)T(207)T(208)T(209)T(210)T(211)T(212)T(213)T(214)T(215)T(216)T(217)T(218)T(219)T(220)T(221)T(222)T(223) \ |
1025 | | T(224)T(225)T(226)T(227)T(228)T(229)T(230)T(231)T(232)T(233)T(234)T(235)T(236)T(237)T(238)T(239)T(240)T(241)T(242)T(243)T(244)T(245)T(246)T(247)T(248)T(249)T(250)T(251)T(252)T(253)T(254)T(255) |
1026 | | |
1027 | | template <std::size_t N> |
1028 | | struct valid_count_t { |
1029 | | std::uint16_t count = 0; |
1030 | | std::uint16_t offsets[N] = {}; |
1031 | | |
1032 | 0 | constexpr void set(std::size_t i) noexcept { |
1033 | 0 | offsets[count++] = static_cast<std::uint16_t>(i); |
1034 | 0 | } |
1035 | | }; |
1036 | | |
1037 | | template <typename E, enum_subtype S, std::size_t Size, int Min, std::size_t J> |
1038 | 0 | constexpr void valid_count(valid_count_t<Size>& vc) noexcept { |
1039 | 0 | #define MAGIC_ENUM_V(O) \ |
1040 | 0 | if constexpr ((J + O) < Size) { \ |
1041 | 0 | if constexpr (is_valid<E, ualue<E, Min, S>(J + O)>()) { \ |
1042 | 0 | vc.set(J + O); \ |
1043 | 0 | } \ |
1044 | 0 | } |
1045 | 0 |
|
1046 | 0 | MAGIC_ENUM_FOR_EACH_256(MAGIC_ENUM_V) |
1047 | 0 |
|
1048 | 0 | if constexpr ((J + 256) < Size) { |
1049 | 0 | valid_count<E, S, Size, Min, J + 256>(vc); |
1050 | 0 | } |
1051 | 0 | #undef MAGIC_ENUM_V |
1052 | 0 | } |
1053 | | |
1054 | | template <typename E, enum_subtype S, std::size_t Size, int Min> |
1055 | 0 | constexpr auto valid_count() noexcept { |
1056 | 0 | valid_count_t<Size> vc; |
1057 | 0 | valid_count<E, S, Size, Min, 0>(vc); |
1058 | 0 | return vc; |
1059 | 0 | } |
1060 | | |
1061 | | template <typename E, enum_subtype S, std::size_t Size, int Min> |
1062 | 0 | constexpr auto values() noexcept { |
1063 | 0 | constexpr auto vc = valid_count<E, S, Size, Min>(); |
1064 | 0 | static_assert(vc.count <= Size); |
1065 | 0 |
|
1066 | 0 | if constexpr (vc.count > 0) { |
1067 | 0 | #if defined(MAGIC_ENUM_ARRAY_CONSTEXPR) |
1068 | 0 | std::array<E, vc.count> values = {}; |
1069 | 0 | #else |
1070 | 0 | E values[vc.count] = {}; |
1071 | 0 | #endif |
1072 | 0 | if constexpr (vc.count == Size) { |
1073 | 0 | for (std::size_t i = 0; i < vc.count; ++i) { |
1074 | 0 | values[i] = value<E, Min, S>(i); |
1075 | 0 | } |
1076 | 0 | } else { |
1077 | 0 | for (std::size_t i = 0; i < vc.count; ++i) { |
1078 | 0 | values[i] = value<E, Min, S>(vc.offsets[i]); |
1079 | 0 | } |
1080 | 0 | } |
1081 | 0 | #if defined(MAGIC_ENUM_ARRAY_CONSTEXPR) |
1082 | 0 | return values; |
1083 | 0 | #else |
1084 | 0 | return to_array(values, std::make_index_sequence<vc.count>{}); |
1085 | 0 | #endif |
1086 | 0 | } else { |
1087 | 0 | return std::array<E, 0>{}; |
1088 | 0 | } |
1089 | 0 | } |
1090 | | |
1091 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1092 | 0 | constexpr auto values() noexcept { |
1093 | 0 | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
1094 | 0 | std::array<E, reflection::table_size<E, S>()> values{}; |
1095 | 0 | for (std::size_t i = 0; i < values.size(); ++i) { |
1096 | 0 | values[i] = reflection::table_v<E, S>.entries[i].value; |
1097 | 0 | } |
1098 | 0 | return values; |
1099 | 0 | #else |
1100 | 0 | constexpr auto min = reflected_min<E, S>(); |
1101 | 0 | constexpr auto max = reflected_max<E, S>(); |
1102 | 0 | constexpr bool valid_range = min <= max; |
1103 | 0 | static_assert(valid_range, "magic_enum::enum_range requires min <= max."); |
1104 | 0 |
|
1105 | 0 | if constexpr (valid_range) { |
1106 | 0 | constexpr auto range_size = max - min + 1; |
1107 | 0 | constexpr bool valid_size = range_size <= (std::numeric_limits<std::uint16_t>::max)(); |
1108 | 0 | static_assert(valid_size, "magic_enum::enum_range requires valid size."); |
1109 | 0 |
|
1110 | 0 | if constexpr (valid_size) { |
1111 | 0 | return values<E, S, range_size, min>(); |
1112 | 0 | } else { |
1113 | 0 | return std::array<E, 0>{}; |
1114 | 0 | } |
1115 | 0 | } else { |
1116 | 0 | return std::array<E, 0>{}; |
1117 | 0 | } |
1118 | 0 | #endif |
1119 | 0 | } |
1120 | | |
1121 | | template <typename E> |
1122 | 0 | constexpr enum_subtype subtype() noexcept { |
1123 | 0 | if constexpr (std::is_enum_v<E>) { |
1124 | 0 | if constexpr (has_is_flags<E>::value) { |
1125 | 0 | return customize::enum_range<E>::is_flags ? enum_subtype::flags : enum_subtype::common; |
1126 | 0 | } |
1127 | 0 | } |
1128 | 0 | return enum_subtype::common; |
1129 | 0 | } |
1130 | | |
1131 | | template <typename E, typename D = std::decay_t<E>> |
1132 | | inline constexpr enum_subtype subtype_v = subtype<D>(); |
1133 | | |
1134 | | template <typename E, enum_subtype S> |
1135 | | inline constexpr auto values_v = values<E, S>(); |
1136 | | |
1137 | | template <typename E, enum_subtype S, typename D = std::decay_t<E>> |
1138 | | using values_t = decltype((values_v<D, S>)); |
1139 | | |
1140 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
1141 | | |
1142 | | template <typename E, enum_subtype S> |
1143 | | inline constexpr auto count_v = reflection::table_size<E, S>(); |
1144 | | |
1145 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1146 | | inline constexpr auto min_v = (count_v<E, S> > 0) ? static_cast<U>(reflection::table_v<E, S>.entries.front().value) : U{0}; |
1147 | | |
1148 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1149 | | inline constexpr auto max_v = (count_v<E, S> > 0) ? static_cast<U>(reflection::table_v<E, S>.entries[count_v<E, S> - 1].value) : U{0}; |
1150 | | |
1151 | | #else |
1152 | | |
1153 | | template <typename E, enum_subtype S> |
1154 | | inline constexpr auto count_v = values_v<E, S>.size(); |
1155 | | |
1156 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1157 | | inline constexpr auto min_v = (count_v<E, S> > 0) ? static_cast<U>(values_v<E, S>.front()) : U{0}; |
1158 | | |
1159 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1160 | | inline constexpr auto max_v = (count_v<E, S> > 0) ? static_cast<U>(values_v<E, S>.back()) : U{0}; |
1161 | | |
1162 | | #endif |
1163 | | |
1164 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
1165 | | |
1166 | | template <typename E, enum_subtype S> |
1167 | | constexpr auto names() noexcept { |
1168 | | std::array<string_view, count_v<E, S>> names{}; |
1169 | | for (std::size_t i = 0; i < names.size(); ++i) { |
1170 | | names[i] = reflection::table_v<E, S>.entries[i].name.view(); |
1171 | | } |
1172 | | return names; |
1173 | | } |
1174 | | |
1175 | | template <typename E, enum_subtype S> |
1176 | | inline constexpr auto names_v = names<E, S>(); |
1177 | | |
1178 | | #else |
1179 | | |
1180 | | template <typename E, enum_subtype S, std::size_t... J> |
1181 | 0 | constexpr auto names(std::index_sequence<J...>) noexcept { |
1182 | 0 | constexpr auto names = std::array<string_view, sizeof...(J)>{{enum_name_v<E, values_v<E, S>[J]>.str()...}}; |
1183 | 0 | return names; |
1184 | 0 | } |
1185 | | |
1186 | | template <typename E, enum_subtype S> |
1187 | | inline constexpr auto names_v = names<E, S>(std::make_index_sequence<count_v<E, S>>{}); |
1188 | | |
1189 | | #endif |
1190 | | |
1191 | | template <typename E, enum_subtype S, typename D = std::decay_t<E>> |
1192 | | using names_t = decltype((names_v<D, S>)); |
1193 | | |
1194 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
1195 | | |
1196 | | template <typename E, enum_subtype S> |
1197 | | constexpr auto entries() noexcept { |
1198 | | std::array<std::pair<E, string_view>, count_v<E, S>> entries{}; |
1199 | | for (std::size_t i = 0; i < entries.size(); ++i) { |
1200 | | entries[i] = {reflection::table_v<E, S>.entries[i].value, reflection::table_v<E, S>.entries[i].name.view()}; |
1201 | | } |
1202 | | return entries; |
1203 | | } |
1204 | | |
1205 | | template <typename E, enum_subtype S> |
1206 | | inline constexpr auto entries_v = entries<E, S>(); |
1207 | | |
1208 | | #else |
1209 | | |
1210 | | template <typename E, enum_subtype S, std::size_t... J> |
1211 | 0 | constexpr auto entries(std::index_sequence<J...>) noexcept { |
1212 | 0 | constexpr auto entries = std::array<std::pair<E, string_view>, sizeof...(J)>{{{values_v<E, S>[J], enum_name_v<E, values_v<E, S>[J]>.str()}...}}; |
1213 | 0 | return entries; |
1214 | 0 | } |
1215 | | |
1216 | | template <typename E, enum_subtype S> |
1217 | | inline constexpr auto entries_v = entries<E, S>(std::make_index_sequence<count_v<E, S>>{}); |
1218 | | |
1219 | | #endif |
1220 | | |
1221 | | template <typename E, enum_subtype S, typename D = std::decay_t<E>> |
1222 | | using entries_t = decltype((entries_v<D, S>)); |
1223 | | |
1224 | | template <typename E, enum_subtype S, typename U = std::underlying_type_t<E>> |
1225 | 0 | constexpr bool is_sparse() noexcept { |
1226 | 0 | if constexpr (count_v<E, S> == 0) { |
1227 | 0 | return false; |
1228 | 0 | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
1229 | 0 | } else if constexpr (S == enum_subtype::common) { |
1230 | 0 | if constexpr (cmp_less(min_v<E, S>, (std::numeric_limits<int>::min)()) || cmp_less((std::numeric_limits<int>::max)(), max_v<E, S>)) { |
1231 | 0 | return true; |
1232 | 0 | } else { |
1233 | 0 | for (std::size_t i = 1; i < count_v<E, S>; ++i) { |
1234 | 0 | if (static_cast<U>(reflection::table_v<E, S>.entries[i - 1].value) + U{1} != static_cast<U>(reflection::table_v<E, S>.entries[i].value)) { |
1235 | 0 | return true; |
1236 | 0 | } |
1237 | 0 | } |
1238 | 0 | return false; |
1239 | 0 | } |
1240 | 0 | #endif |
1241 | 0 | } else if constexpr (S == enum_subtype::flags) { |
1242 | 0 | using V = make_unsigned_t<U>; |
1243 | 0 | constexpr auto max = log2(static_cast<V>(max_v<E, S>)); |
1244 | 0 | constexpr auto min = log2(static_cast<V>(min_v<E, S>)); |
1245 | 0 | constexpr auto range_size = max - min + 1; |
1246 | 0 |
|
1247 | 0 | return range_size != count_v<E, S>; |
1248 | 0 | } else { |
1249 | 0 | constexpr auto max = max_v<E, S>; |
1250 | 0 | constexpr auto min = min_v<E, S>; |
1251 | 0 | constexpr auto range_size = max - min + 1; |
1252 | 0 |
|
1253 | 0 | return range_size != count_v<E, S>; |
1254 | 0 | } |
1255 | 0 | } |
1256 | | |
1257 | | template <typename E, enum_subtype S = subtype_v<E>> |
1258 | | inline constexpr bool is_sparse_v = is_sparse<E, S>(); |
1259 | | |
1260 | | #if defined(MAGIC_ENUM_NO_CHECK_REFLECTED_ENUM) |
1261 | | template <typename, enum_subtype> |
1262 | | struct is_reflected : std::true_type {}; |
1263 | | #else |
1264 | | template <typename E, enum_subtype S, bool = std::is_enum_v<std::decay_t<E>>> |
1265 | | struct is_reflected : std::false_type {}; |
1266 | | |
1267 | | template <typename E, enum_subtype S> |
1268 | | struct is_reflected<E, S, true> : std::bool_constant<count_v<std::decay_t<E>, S> != 0> {}; |
1269 | | #endif |
1270 | | |
1271 | | template <typename E, enum_subtype S> |
1272 | | inline constexpr bool is_reflected_v = is_reflected<E, S>::value; |
1273 | | |
1274 | | template <bool, typename R> |
1275 | | struct enable_if_enum {}; |
1276 | | |
1277 | | template <typename R> |
1278 | | struct enable_if_enum<true, R> { |
1279 | | using type = R; |
1280 | | static_assert(supported<R>::value, "magic_enum unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); |
1281 | | }; |
1282 | | |
1283 | | template <typename T, typename R, typename BinaryPredicate = std::equal_to<>, typename D = std::decay_t<T>> |
1284 | | using enable_if_t = typename enable_if_enum<std::is_enum_v<D> && std::is_invocable_r_v<bool, BinaryPredicate&, char_type, char_type>, R>::type; |
1285 | | |
1286 | | template <typename T, std::enable_if_t<std::is_enum_v<std::decay_t<T>>, int> = 0> |
1287 | | using enum_concept = T; |
1288 | | |
1289 | | template <typename T, bool = std::is_enum_v<T>> |
1290 | | struct is_scoped_enum : std::false_type {}; |
1291 | | |
1292 | | template <typename T> |
1293 | | struct is_scoped_enum<T, true> : std::bool_constant<!std::is_convertible_v<T, std::underlying_type_t<T>>> {}; |
1294 | | |
1295 | | template <typename T, bool = std::is_enum_v<T>> |
1296 | | struct is_unscoped_enum : std::false_type {}; |
1297 | | |
1298 | | template <typename T> |
1299 | | struct is_unscoped_enum<T, true> : std::bool_constant<std::is_convertible_v<T, std::underlying_type_t<T>>> {}; |
1300 | | |
1301 | | template <typename T, bool = std::is_enum_v<T>> |
1302 | | struct is_flags_enum : std::false_type {}; |
1303 | | |
1304 | | template <typename T> |
1305 | | struct is_flags_enum<T, true> : std::bool_constant<subtype_v<T> == enum_subtype::flags> {}; |
1306 | | |
1307 | | template <typename T, bool = std::is_enum_v<std::decay_t<T>>> |
1308 | | struct underlying_type {}; |
1309 | | |
1310 | | template <typename T> |
1311 | | struct underlying_type<T, true> : std::underlying_type<std::decay_t<T>> {}; |
1312 | | |
1313 | | #if defined(MAGIC_ENUM_ENABLE_HASH) || defined(MAGIC_ENUM_ENABLE_HASH_SWITCH) |
1314 | | |
1315 | | template <typename Value, typename = void> |
1316 | | struct constexpr_hash_t; |
1317 | | |
1318 | | template <typename Value> |
1319 | | struct constexpr_hash_t<Value, std::enable_if_t<is_enum_v<Value>>> { |
1320 | | using U = typename underlying_type<Value>::type; |
1321 | | |
1322 | | constexpr auto operator()(Value value) const noexcept { |
1323 | | return operator()(static_cast<U>(value)); |
1324 | | } |
1325 | | |
1326 | | constexpr auto operator()(U value) const noexcept { |
1327 | | if constexpr (std::is_same_v<U, bool>) { // bool special case |
1328 | | return static_cast<std::size_t>(value); |
1329 | | } else { |
1330 | | return value; |
1331 | | } |
1332 | | } |
1333 | | |
1334 | | using secondary_hash = constexpr_hash_t; |
1335 | | }; |
1336 | | |
1337 | | template <typename Value> |
1338 | | struct constexpr_hash_t<Value, std::enable_if_t<std::is_same_v<Value, string_view>>> { |
1339 | | static constexpr std::uint32_t crc_table[256] { |
1340 | | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, |
1341 | | 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L, |
1342 | | 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, |
1343 | | 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, |
1344 | | 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, |
1345 | | 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, |
1346 | | 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, |
1347 | | 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, |
1348 | | 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L, |
1349 | | 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, |
1350 | | 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, |
1351 | | 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L, |
1352 | | 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, |
1353 | | 0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L, |
1354 | | 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, |
1355 | | 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, |
1356 | | 0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L, |
1357 | | 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, |
1358 | | 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L, |
1359 | | 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, |
1360 | | 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, |
1361 | | 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L, |
1362 | | 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, |
1363 | | 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL, |
1364 | | 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, |
1365 | | 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, |
1366 | | 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L, |
1367 | | 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, |
1368 | | 0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL, |
1369 | | 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, |
1370 | | 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL, |
1371 | | 0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL |
1372 | | }; |
1373 | | constexpr std::uint32_t operator()(string_view value) const noexcept { |
1374 | | auto crc = static_cast<std::uint32_t>(0xffffffffL); |
1375 | | for (const auto c : value) { |
1376 | | crc = (crc >> 8) ^ crc_table[(crc ^ static_cast<std::uint32_t>(c)) & 0xff]; |
1377 | | } |
1378 | | return crc ^ 0xffffffffL; |
1379 | | } |
1380 | | |
1381 | | struct secondary_hash { |
1382 | | constexpr std::uint32_t operator()(string_view value) const noexcept { |
1383 | | std::uint64_t acc = 2166136261ULL; |
1384 | | for (const auto c : value) { |
1385 | | acc = ((acc ^ static_cast<std::uint64_t>(c)) * 16777619ULL) & (std::numeric_limits<std::uint32_t>::max)(); |
1386 | | } |
1387 | | return static_cast<std::uint32_t>(acc); |
1388 | | } |
1389 | | }; |
1390 | | }; |
1391 | | |
1392 | | template <typename Hash> |
1393 | | inline constexpr Hash hash_v{}; |
1394 | | |
1395 | | template <auto* GlobValues, typename Hash> |
1396 | | constexpr auto calculate_cases(std::size_t Page) noexcept { |
1397 | | constexpr const auto& values = *GlobValues; |
1398 | | constexpr std::size_t size = values.size(); |
1399 | | |
1400 | | using switch_t = std::invoke_result_t<Hash, typename std::decay_t<decltype(values)>::value_type>; |
1401 | | static_assert(std::is_integral_v<switch_t> && !std::is_same_v<switch_t, bool>); |
1402 | | const std::size_t values_to = (std::min)(static_cast<std::size_t>(256), size - Page); |
1403 | | |
1404 | | std::array<switch_t, 256> result{}; |
1405 | | auto fill = result.begin(); |
1406 | | { |
1407 | | auto first = values.begin() + static_cast<std::ptrdiff_t>(Page); |
1408 | | auto last = values.begin() + static_cast<std::ptrdiff_t>(Page + values_to); |
1409 | | while (first != last) { |
1410 | | *fill++ = hash_v<Hash>(*first++); |
1411 | | } |
1412 | | } |
1413 | | |
1414 | | auto value = (std::numeric_limits<switch_t>::min)(); |
1415 | | while (fill != result.end()) { |
1416 | | bool used = false; |
1417 | | for (std::size_t i = 0; i < values_to; ++i) { |
1418 | | if (result[i] == value) { |
1419 | | used = true; |
1420 | | break; |
1421 | | } |
1422 | | } |
1423 | | if (!used) { |
1424 | | *fill++ = value; |
1425 | | } |
1426 | | value = value == (std::numeric_limits<switch_t>::max)() ? (std::numeric_limits<switch_t>::min)() : static_cast<switch_t>(value + 1); |
1427 | | } |
1428 | | |
1429 | | return result; |
1430 | | } |
1431 | | |
1432 | | template <typename R, typename F, typename... Args> |
1433 | | constexpr R invoke_r(F&& f, Args&&... args) noexcept(std::is_nothrow_invocable_r_v<R, F, Args...>) { |
1434 | | if constexpr (std::is_void_v<R>) { |
1435 | | std::forward<F>(f)(std::forward<Args>(args)...); |
1436 | | } else { |
1437 | | return static_cast<R>(std::forward<F>(f)(std::forward<Args>(args)...)); |
1438 | | } |
1439 | | } |
1440 | | |
1441 | | enum class case_call_t { |
1442 | | index, |
1443 | | value |
1444 | | }; |
1445 | | |
1446 | | template <typename T = void> |
1447 | | inline constexpr auto default_result_type_lambda = []() noexcept(std::is_nothrow_default_constructible_v<T>) { return T{}; }; |
1448 | | |
1449 | | template <> |
1450 | | inline constexpr auto default_result_type_lambda<void> = []() noexcept {}; |
1451 | | |
1452 | | template <typename T, std::size_t N> |
1453 | | constexpr void hash_heap_sift_down(std::array<T, N>& values, std::size_t root, std::size_t end) noexcept { |
1454 | | while (root < end / 2) { |
1455 | | auto child = root * 2 + 1; |
1456 | | if (child + 1 < end && values[child] < values[child + 1]) { |
1457 | | ++child; |
1458 | | } |
1459 | | if (!(values[root] < values[child])) { |
1460 | | return; |
1461 | | } |
1462 | | auto tmp = values[root]; |
1463 | | values[root] = values[child]; |
1464 | | values[child] = tmp; |
1465 | | root = child; |
1466 | | } |
1467 | | } |
1468 | | |
1469 | | template <typename T, std::size_t N> |
1470 | | constexpr void hash_heap_sort(std::array<T, N>& values) noexcept { |
1471 | | for (auto root = N / 2; root > 0; --root) { |
1472 | | hash_heap_sift_down(values, root - 1, N); |
1473 | | } |
1474 | | for (auto end = N; end > 1; --end) { |
1475 | | auto tmp = values[0]; |
1476 | | values[0] = values[end - 1]; |
1477 | | values[end - 1] = tmp; |
1478 | | hash_heap_sift_down(values, 0, end - 1); |
1479 | | } |
1480 | | } |
1481 | | |
1482 | | template <auto* Arr, typename Hash> |
1483 | | constexpr bool has_unique_hashes() noexcept { |
1484 | | using value_t = std::decay_t<decltype((*Arr)[0])>; |
1485 | | using hash_value_t = std::invoke_result_t<Hash, value_t>; |
1486 | | if constexpr (Arr->size() > 1) { |
1487 | | auto previous = hash_v<Hash>((*Arr)[0]); |
1488 | | bool strictly_increasing = true; |
1489 | | for (std::size_t i = 1; i < Arr->size(); ++i) { |
1490 | | const auto current = hash_v<Hash>((*Arr)[i]); |
1491 | | if (!(previous < current)) { |
1492 | | if (previous == current) { |
1493 | | return false; |
1494 | | } |
1495 | | strictly_increasing = false; |
1496 | | break; |
1497 | | } |
1498 | | previous = current; |
1499 | | } |
1500 | | if (strictly_increasing) { |
1501 | | return true; |
1502 | | } |
1503 | | } |
1504 | | |
1505 | | std::array<hash_value_t, Arr->size()> hashes{}; |
1506 | | if constexpr (Arr->size() <= 32) { |
1507 | | std::size_t size = 0; |
1508 | | for (auto elem : *Arr) { |
1509 | | hashes[size] = hash_v<Hash>(elem); |
1510 | | for (auto i = size++; i > 0; --i) { |
1511 | | if (hashes[i] < hashes[i - 1]) { |
1512 | | auto tmp = hashes[i]; |
1513 | | hashes[i] = hashes[i - 1]; |
1514 | | hashes[i - 1] = tmp; |
1515 | | } else if (hashes[i] == hashes[i - 1]) { |
1516 | | return false; |
1517 | | } else { |
1518 | | break; |
1519 | | } |
1520 | | } |
1521 | | } |
1522 | | } else { |
1523 | | std::size_t size = 0; |
1524 | | for (auto elem : *Arr) { |
1525 | | hashes[size++] = hash_v<Hash>(elem); |
1526 | | } |
1527 | | hash_heap_sort(hashes); |
1528 | | for (std::size_t i = 1; i < hashes.size(); ++i) { |
1529 | | if (hashes[i - 1] == hashes[i]) { |
1530 | | return false; |
1531 | | } |
1532 | | } |
1533 | | } |
1534 | | return true; |
1535 | | } |
1536 | | |
1537 | | template <auto* Arr, typename Hash> |
1538 | | inline constexpr bool has_unique_hashes_v = has_unique_hashes<Arr, Hash>(); |
1539 | | |
1540 | | template <auto* Arr, typename Hash> |
1541 | | inline constexpr bool has_usable_hash_v = has_unique_hashes_v<Arr, Hash> || has_unique_hashes_v<Arr, typename Hash::secondary_hash>; |
1542 | | |
1543 | | #define MAGIC_ENUM_CASE(val) \ |
1544 | | case cases[val]: \ |
1545 | | if constexpr ((val) + Page < size) { \ |
1546 | | if (!pred(values[val + Page], searched)) { \ |
1547 | | break; \ |
1548 | | } \ |
1549 | | if constexpr (CallValue == case_call_t::index) { \ |
1550 | | if constexpr (std::is_invocable_r_v<result_t, Lambda, std::integral_constant<std::size_t, val + Page>>) { \ |
1551 | | return detail::invoke_r<result_t>(std::forward<Lambda>(lambda), std::integral_constant<std::size_t, val + Page>{}); \ |
1552 | | } else if constexpr (std::is_invocable_v<Lambda, std::integral_constant<std::size_t, val + Page>>) { \ |
1553 | | MAGIC_ENUM_ASSERT(false && "magic_enum::detail::hash_switch wrong result type."); \ |
1554 | | } \ |
1555 | | } else if constexpr (CallValue == case_call_t::value) { \ |
1556 | | if constexpr (std::is_invocable_r_v<result_t, Lambda, enum_constant<values[val + Page]>>) { \ |
1557 | | return detail::invoke_r<result_t>(std::forward<Lambda>(lambda), enum_constant<values[val + Page]>{}); \ |
1558 | | } else if constexpr (std::is_invocable_v<Lambda, enum_constant<values[val + Page]>>) { \ |
1559 | | MAGIC_ENUM_ASSERT(false && "magic_enum::detail::hash_switch wrong result type."); \ |
1560 | | } \ |
1561 | | } \ |
1562 | | break; \ |
1563 | | } else [[fallthrough]]; |
1564 | | |
1565 | | template <auto* GlobValues, |
1566 | | case_call_t CallValue, |
1567 | | std::size_t Page, |
1568 | | typename Hash, |
1569 | | typename BinaryPredicate, |
1570 | | typename Lambda, |
1571 | | typename Searched, |
1572 | | typename SearchedHash, |
1573 | | typename ResultGetterType> |
1574 | | constexpr decltype(auto) hash_switch_page( |
1575 | | Lambda&& lambda, |
1576 | | Searched searched, |
1577 | | SearchedHash searched_hash, |
1578 | | ResultGetterType&& def, |
1579 | | BinaryPredicate&& pred) { |
1580 | | using result_t = std::invoke_result_t<ResultGetterType>; |
1581 | | constexpr const auto& values = *GlobValues; |
1582 | | constexpr std::size_t size = values.size(); |
1583 | | constexpr auto cases = calculate_cases<GlobValues, Hash>(Page); |
1584 | | |
1585 | | switch (searched_hash) { |
1586 | | MAGIC_ENUM_FOR_EACH_256(MAGIC_ENUM_CASE) |
1587 | | default: |
1588 | | if constexpr (size > 256 + Page) { |
1589 | | return hash_switch_page<GlobValues, CallValue, Page + 256, Hash>(std::forward<Lambda>(lambda), searched, searched_hash, std::forward<ResultGetterType>(def), std::forward<BinaryPredicate>(pred)); |
1590 | | } |
1591 | | break; |
1592 | | } |
1593 | | return def(); |
1594 | | } |
1595 | | |
1596 | | template <auto* GlobValues, |
1597 | | case_call_t CallValue, |
1598 | | std::size_t Page = 0, |
1599 | | typename Hash = constexpr_hash_t<typename std::decay_t<decltype(*GlobValues)>::value_type>, |
1600 | | typename BinaryPredicate = std::equal_to<>, |
1601 | | typename Lambda, |
1602 | | typename Searched, |
1603 | | typename ResultGetterType> |
1604 | | constexpr decltype(auto) hash_switch( |
1605 | | Lambda&& lambda, |
1606 | | Searched searched, |
1607 | | ResultGetterType&& def, |
1608 | | BinaryPredicate&& pred = {}) { |
1609 | | using hash_t = std::conditional_t<has_unique_hashes_v<GlobValues, Hash>, Hash, typename Hash::secondary_hash>; |
1610 | | static_assert(has_unique_hashes_v<GlobValues, hash_t>, "magic_enum::detail::hash_switch duplicated hash found, please report it: https://github.com/Neargye/magic_enum/issues."); |
1611 | | const auto searched_hash = hash_v<hash_t>(searched); |
1612 | | return hash_switch_page<GlobValues, CallValue, Page, hash_t>(std::forward<Lambda>(lambda), searched, searched_hash, std::forward<ResultGetterType>(def), std::forward<BinaryPredicate>(pred)); |
1613 | | } |
1614 | | |
1615 | | // values_v<E, S> is unique, and constexpr_hash_t<E> preserves its underlying values. |
1616 | | template <typename E, |
1617 | | enum_subtype S, |
1618 | | case_call_t CallValue, |
1619 | | typename BinaryPredicate = std::equal_to<>, |
1620 | | typename Lambda, |
1621 | | typename Searched, |
1622 | | typename ResultGetterType> |
1623 | | constexpr decltype(auto) hash_switch_values( |
1624 | | Lambda&& lambda, |
1625 | | Searched searched, |
1626 | | ResultGetterType&& def, |
1627 | | BinaryPredicate&& pred = {}) { |
1628 | | using D = std::decay_t<E>; |
1629 | | using hash_t = constexpr_hash_t<D>; |
1630 | | static_assert(std::is_enum_v<D>); |
1631 | | const auto searched_hash = hash_v<hash_t>(searched); |
1632 | | return hash_switch_page<&values_v<D, S>, CallValue, 0, hash_t>(std::forward<Lambda>(lambda), searched, searched_hash, std::forward<ResultGetterType>(def), std::forward<BinaryPredicate>(pred)); |
1633 | | } |
1634 | | |
1635 | | #undef MAGIC_ENUM_CASE |
1636 | | |
1637 | | #endif |
1638 | | |
1639 | | } // namespace magic_enum::detail |
1640 | | |
1641 | | // Checks is magic_enum supported compiler. |
1642 | | inline constexpr bool is_magic_enum_supported = detail::supported<void>::value; |
1643 | | |
1644 | | template <typename T> |
1645 | | using Enum = detail::enum_concept<T>; |
1646 | | |
1647 | | // Identifies unscoped enum types. |
1648 | | template <typename T> |
1649 | | struct is_unscoped_enum : detail::is_unscoped_enum<T> {}; |
1650 | | |
1651 | | template <typename T> |
1652 | | inline constexpr bool is_unscoped_enum_v = is_unscoped_enum<T>::value; |
1653 | | |
1654 | | // Identifies scoped enum types. |
1655 | | template <typename T> |
1656 | | struct is_scoped_enum : detail::is_scoped_enum<T> {}; |
1657 | | |
1658 | | template <typename T> |
1659 | | inline constexpr bool is_scoped_enum_v = is_scoped_enum<T>::value; |
1660 | | |
1661 | | // Identifies flag enum types (i.e., enum_range<T>::is_flags == true). |
1662 | | template <typename T> |
1663 | | struct is_flags_enum : detail::is_flags_enum<T> {}; |
1664 | | |
1665 | | template <typename T> |
1666 | | inline constexpr bool is_flags_v = is_flags_enum<T>::value; |
1667 | | |
1668 | | // If T is a complete enumeration type, provides a member typedef type that names the underlying type of T. |
1669 | | // Otherwise, if T is not an enumeration type, there is no member type. Otherwise (T is an incomplete enumeration type), the program is ill-formed. |
1670 | | template <typename T> |
1671 | | struct underlying_type : detail::underlying_type<T> {}; |
1672 | | |
1673 | | template <typename T> |
1674 | | using underlying_type_t = typename underlying_type<T>::type; |
1675 | | |
1676 | | template <auto V> |
1677 | | using enum_constant = detail::enum_constant<V>; |
1678 | | |
1679 | | // Returns type name of enum. |
1680 | | template <typename E> |
1681 | | [[nodiscard]] constexpr auto enum_type_name() noexcept -> detail::enable_if_t<E, string_view> { |
1682 | | constexpr string_view name = detail::type_name_v<std::decay_t<E>>.str(); |
1683 | | static_assert(!name.empty(), "magic_enum::enum_type_name enum type does not have a name."); |
1684 | | |
1685 | | return name; |
1686 | | } |
1687 | | |
1688 | | // Returns number of enum values. |
1689 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1690 | 7.25k | [[nodiscard]] constexpr auto enum_count() noexcept -> detail::enable_if_t<E, std::size_t> { |
1691 | 7.25k | return detail::count_v<std::decay_t<E>, S>; |
1692 | 7.25k | } |
1693 | | |
1694 | | // Returns enum value at specified index. |
1695 | | // No bounds checking is performed: the behavior is undefined if index >= number of enum values. |
1696 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1697 | 38.3k | [[nodiscard]] constexpr auto enum_value(std::size_t index) noexcept -> detail::enable_if_t<E, std::decay_t<E>> { |
1698 | 38.3k | using D = std::decay_t<E>; |
1699 | 38.3k | using U = underlying_type_t<D>; |
1700 | 38.3k | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1701 | | |
1702 | 38.3k | if constexpr (detail::is_sparse_v<D, S>) { |
1703 | 38.3k | return MAGIC_ENUM_ASSERT(index < detail::count_v<D, S>), detail::values_v<D, S>[index]; |
1704 | | } else if constexpr (S == detail::enum_subtype::flags) { |
1705 | | using V = detail::make_unsigned_t<U>; |
1706 | | constexpr auto min = detail::log2(static_cast<V>(detail::min_v<D, S>)); |
1707 | | |
1708 | | return MAGIC_ENUM_ASSERT(index < detail::count_v<D, S>), detail::value<D, min, S>(index); |
1709 | | } else { |
1710 | | constexpr auto min = detail::min_v<D, S>; |
1711 | | |
1712 | | return MAGIC_ENUM_ASSERT(index < detail::count_v<D, S>), detail::value<D, min, S>(index); |
1713 | | } |
1714 | 38.3k | } |
1715 | | |
1716 | | // Returns enum value at specified index. |
1717 | | template <typename E, std::size_t J, detail::enum_subtype S = detail::subtype_v<E>> |
1718 | | [[nodiscard]] constexpr auto enum_value() noexcept -> detail::enable_if_t<E, std::decay_t<E>> { |
1719 | | using D = std::decay_t<E>; |
1720 | | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1721 | | static_assert(J < detail::count_v<D, S>, "magic_enum::enum_value out of range."); |
1722 | | |
1723 | | return enum_value<D, S>(J); |
1724 | | } |
1725 | | |
1726 | | // Returns std::array with enum values, sorted by enum value. |
1727 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1728 | 0 | [[nodiscard]] constexpr auto enum_values() noexcept -> detail::enable_if_t<E, detail::values_t<E, S>> { |
1729 | 0 | using D = std::decay_t<E>; |
1730 | 0 | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1731 | 0 |
|
1732 | 0 | return detail::values_v<D, S>; |
1733 | 0 | } Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum11enum_valuesIKZ22LLVMFuzzerTestOneInputE8FuzzEnumLNS_6detail12enum_subtypeE0EEENS3_14enable_if_enumIXaasr3stdE9is_enum_vIu7__decayIT_EEL_ZNSt3__116is_invocable_r_vIbRNS8_8equal_toIvEEJccEEEEEDT8values_vIS7_XT0_EEEE4typeEv Unexecuted instantiation: magic_enum_fuzzer.cc:_ZN10magic_enum11enum_valuesIZ22LLVMFuzzerTestOneInputE8FuzzEnumLNS_6detail12enum_subtypeE0EEENS2_14enable_if_enumIXaasr3stdE9is_enum_vIu7__decayIT_EEL_ZNSt3__116is_invocable_r_vIbRNS7_8equal_toIvEEJccEEEEEDT8values_vIS6_XT0_EEEE4typeEv |
1734 | | |
1735 | | // Returns integer value from enum value. |
1736 | | template <typename E> |
1737 | | [[nodiscard]] constexpr auto enum_integer(E value) noexcept -> underlying_type_t<E> { |
1738 | | return static_cast<underlying_type_t<E>>(value); |
1739 | | } |
1740 | | |
1741 | | // Returns underlying value from enum value. |
1742 | | template <typename E> |
1743 | | [[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> underlying_type_t<E> { |
1744 | | return static_cast<underlying_type_t<E>>(value); |
1745 | | } |
1746 | | |
1747 | | // Returns index in enum values from enum value. |
1748 | | // Returns optional with index. |
1749 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1750 | 8.29k | [[nodiscard]] constexpr auto enum_index(E value) noexcept -> detail::enable_if_t<E, optional<std::size_t>> { |
1751 | 8.29k | using D = std::decay_t<E>; |
1752 | 8.29k | using U = underlying_type_t<D>; |
1753 | 8.29k | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1754 | | |
1755 | 8.29k | if constexpr (detail::is_sparse_v<D, S> || (S == detail::enum_subtype::flags)) { |
1756 | | #if defined(MAGIC_ENUM_ENABLE_HASH) |
1757 | | return detail::hash_switch_values<D, S, detail::case_call_t::index>( |
1758 | | [](std::size_t i) { return optional<std::size_t>{i}; }, |
1759 | | value, |
1760 | | detail::default_result_type_lambda<optional<std::size_t>>, |
1761 | | [](D lhs, D rhs) { return detail::enum_value_equal(lhs, rhs); }); |
1762 | | #else |
1763 | 16.5k | for (std::size_t i = 0; i < detail::count_v<D, S>; ++i) { |
1764 | 16.5k | if (detail::enum_value_equal(enum_value<D, S>(i), value)) { |
1765 | 8.29k | return i; |
1766 | 8.29k | } |
1767 | 16.5k | } |
1768 | 0 | return {}; // Invalid value or out of range. |
1769 | 8.29k | #endif |
1770 | | } else { |
1771 | | const auto v = static_cast<U>(value); |
1772 | | if (v >= detail::min_v<D, S> && v <= detail::max_v<D, S>) { |
1773 | | return static_cast<std::size_t>(v - detail::min_v<D, S>); |
1774 | | } |
1775 | | return {}; // Invalid value or out of range. |
1776 | | } |
1777 | 8.29k | } |
1778 | | |
1779 | | // Returns index in enum values from enum value. |
1780 | | // Returns optional with index. |
1781 | | template <detail::enum_subtype S, typename E> |
1782 | | [[nodiscard]] constexpr auto enum_index(E value) noexcept -> detail::enable_if_t<E, optional<std::size_t>> { |
1783 | | return enum_index<std::decay_t<E>, S>(value); |
1784 | | } |
1785 | | |
1786 | | // Returns index in enum values from compile-time enum value. |
1787 | | template <auto V, detail::enum_subtype S = detail::subtype_v<decltype(V)>> |
1788 | | [[nodiscard]] constexpr auto enum_index() noexcept -> detail::enable_if_t<decltype(V), std::size_t> { |
1789 | | using D = std::decay_t<decltype(V)>; |
1790 | | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1791 | | constexpr auto index = enum_index<D, S>(V); |
1792 | | static_assert(index, "magic_enum::enum_index enum value has no index."); |
1793 | | |
1794 | | return *index; |
1795 | | } |
1796 | | |
1797 | | // Returns name from compile-time enum value. |
1798 | | // Compiles faster than enum_name(value) and is not restricted by enum_range. |
1799 | | template <auto V> |
1800 | | [[nodiscard]] constexpr auto enum_name() noexcept -> detail::enable_if_t<decltype(V), string_view> { |
1801 | | constexpr string_view name = detail::enum_name_v<std::decay_t<decltype(V)>, V>.str(); |
1802 | | static_assert(!name.empty(), "magic_enum::enum_name enum value does not have a name."); |
1803 | | |
1804 | | return name; |
1805 | | } |
1806 | | |
1807 | | // Returns name from enum value. |
1808 | | // If enum value does not have name or value out of range, returns empty string. |
1809 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1810 | | [[nodiscard]] constexpr auto enum_name(E value) noexcept -> detail::enable_if_t<E, string_view> { |
1811 | | using D = std::decay_t<E>; |
1812 | | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1813 | | |
1814 | | if (const auto i = enum_index<D, S>(value)) { |
1815 | | return detail::names_v<D, S>[*i]; |
1816 | | } |
1817 | | return detail::static_str<0>{}.str(); |
1818 | | } |
1819 | | |
1820 | | // Returns name from enum value. |
1821 | | // If enum value does not have name or value out of range, returns empty string. |
1822 | | template <detail::enum_subtype S, typename E> |
1823 | | [[nodiscard]] constexpr auto enum_name(E value) noexcept -> detail::enable_if_t<E, string_view> { |
1824 | | return enum_name<std::decay_t<E>, S>(value); |
1825 | | } |
1826 | | |
1827 | | // Returns std::array with names, sorted by enum value. |
1828 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1829 | 1.03k | [[nodiscard]] constexpr auto enum_names() noexcept -> detail::enable_if_t<E, detail::names_t<E, S>> { |
1830 | 1.03k | using D = std::decay_t<E>; |
1831 | 1.03k | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1832 | | |
1833 | 1.03k | return detail::names_v<D, S>; |
1834 | 1.03k | } |
1835 | | |
1836 | | // Returns std::array with pairs (value, name), sorted by enum value. |
1837 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1838 | 1.03k | [[nodiscard]] constexpr auto enum_entries() noexcept -> detail::enable_if_t<E, detail::entries_t<E, S>> { |
1839 | 1.03k | using D = std::decay_t<E>; |
1840 | 1.03k | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1841 | | |
1842 | 1.03k | return detail::entries_v<D, S>; |
1843 | 1.03k | } |
1844 | | |
1845 | | // Allows you to write magic_enum::enum_cast<foo>("bar", magic_enum::case_insensitive); |
1846 | | inline constexpr auto case_insensitive = detail::case_insensitive<>{}; |
1847 | | |
1848 | | // Returns enum value from integer value. |
1849 | | // Returns optional with enum value. |
1850 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1851 | 3.11k | [[nodiscard]] constexpr auto enum_cast(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, optional<std::decay_t<E>>> { |
1852 | 3.11k | using D = std::decay_t<E>; |
1853 | 3.11k | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1854 | | |
1855 | 3.11k | if constexpr (detail::is_sparse_v<D, S> || (S == detail::enum_subtype::flags)) { |
1856 | | #if defined(MAGIC_ENUM_ENABLE_HASH) |
1857 | | return detail::hash_switch_values<D, S, detail::case_call_t::value>( |
1858 | | [](D v) { return optional<D>{v}; }, |
1859 | | value, |
1860 | | detail::default_result_type_lambda<optional<D>>, |
1861 | | [](D lhs, underlying_type_t<D> rhs) { return detail::enum_value_equal(lhs, rhs); }); |
1862 | | #else |
1863 | 24.8k | for (std::size_t i = 0; i < detail::count_v<D, S>; ++i) { |
1864 | 21.7k | if (detail::enum_value_equal(enum_value<D, S>(i), value)) { |
1865 | 0 | return static_cast<D>(value); |
1866 | 0 | } |
1867 | 21.7k | } |
1868 | 3.11k | return {}; // Invalid value or out of range. |
1869 | 3.11k | #endif |
1870 | | } else { |
1871 | | if (value >= detail::min_v<D, S> && value <= detail::max_v<D, S>) { |
1872 | | return static_cast<D>(value); |
1873 | | } |
1874 | | return {}; // Invalid value or out of range. |
1875 | | } |
1876 | 3.11k | } |
1877 | | |
1878 | | // Returns enum value from name. |
1879 | | // Returns optional with enum value. |
1880 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>, typename BinaryPredicate = std::equal_to<>> |
1881 | 3.11k | [[nodiscard]] constexpr auto enum_cast(string_view value, [[maybe_unused]] BinaryPredicate p = {}) noexcept(detail::is_nothrow_invocable_v<BinaryPredicate>) -> detail::enable_if_t<E, optional<std::decay_t<E>>, BinaryPredicate> { |
1882 | 3.11k | using D = std::decay_t<E>; |
1883 | 3.11k | static_assert(detail::is_reflected_v<D, S>, "magic_enum requires enum implementation and valid max and min."); |
1884 | | |
1885 | | #if defined(MAGIC_ENUM_ENABLE_HASH) |
1886 | | using hash_t = detail::constexpr_hash_t<string_view>; |
1887 | | if constexpr (detail::is_default_predicate_v<BinaryPredicate> && detail::has_usable_hash_v<&detail::names_v<D, S>, hash_t>) { |
1888 | | return detail::hash_switch<&detail::names_v<D, S>, detail::case_call_t::index>( |
1889 | | [](std::size_t i) { return optional<D>{detail::values_v<D, S>[i]}; }, |
1890 | | value, |
1891 | | detail::default_result_type_lambda<optional<D>>, |
1892 | | [&p](string_view lhs, string_view rhs) { return detail::cmp_equal(lhs, rhs, p); }); |
1893 | | } else { |
1894 | | #endif |
1895 | 24.8k | for (std::size_t i = 0; i < detail::count_v<D, S>; ++i) { |
1896 | 21.7k | if (detail::cmp_equal(value, detail::names_v<D, S>[i], p)) { |
1897 | 15 | return enum_value<D, S>(i); |
1898 | 15 | } |
1899 | 21.7k | } |
1900 | 3.09k | return {}; // Invalid value or out of range. |
1901 | | #if defined(MAGIC_ENUM_ENABLE_HASH) |
1902 | | } |
1903 | | #endif |
1904 | 3.11k | } |
1905 | | |
1906 | | // Returns true if enum contains specified value. |
1907 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1908 | | [[nodiscard]] constexpr auto enum_contains(E value) noexcept -> detail::enable_if_t<E, bool> { |
1909 | | using D = std::decay_t<E>; |
1910 | | using U = underlying_type_t<D>; |
1911 | | |
1912 | | return static_cast<bool>(enum_cast<D, S>(static_cast<U>(value))); |
1913 | | } |
1914 | | |
1915 | | // Returns true if enum contains specified value. |
1916 | | template <detail::enum_subtype S, typename E> |
1917 | | [[nodiscard]] constexpr auto enum_contains(E value) noexcept -> detail::enable_if_t<E, bool> { |
1918 | | return enum_contains<std::decay_t<E>, S>(value); |
1919 | | } |
1920 | | |
1921 | | // Returns true if enum contains specified integer value. |
1922 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1923 | 2.07k | [[nodiscard]] constexpr auto enum_contains(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, bool> { |
1924 | 2.07k | using D = std::decay_t<E>; |
1925 | | |
1926 | 2.07k | return static_cast<bool>(enum_cast<D, S>(value)); |
1927 | 2.07k | } |
1928 | | |
1929 | | // Returns true if enum contains enumerator with specified name. |
1930 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>, typename BinaryPredicate = std::equal_to<>> |
1931 | | [[nodiscard]] constexpr auto enum_contains(string_view value, BinaryPredicate p = {}) noexcept(detail::is_nothrow_invocable_v<BinaryPredicate>) -> detail::enable_if_t<E, bool, BinaryPredicate> { |
1932 | | using D = std::decay_t<E>; |
1933 | | |
1934 | | return static_cast<bool>(enum_cast<D, S, BinaryPredicate&>(value, p)); |
1935 | | } |
1936 | | |
1937 | | // Returns true if enum integer value can be reflected. |
1938 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1939 | | [[nodiscard]] constexpr auto enum_reflected(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, bool> { |
1940 | | using D = std::decay_t<E>; |
1941 | | |
1942 | | #if defined(MAGIC_ENUM_DETAIL_USE_STD_REFLECTION) |
1943 | | return detail::reflection::contains_underlying<D>(value) && detail::reflection::value_valid<D, S>(static_cast<D>(value)); |
1944 | | #else |
1945 | | using T = underlying_type_t<D>; |
1946 | | if constexpr (!detail::is_reflected_v<D, S>) { |
1947 | | return false; |
1948 | | } else { |
1949 | | constexpr auto min = detail::reflected_min<D, S>(); |
1950 | | constexpr auto max = detail::reflected_max<D, S>(); |
1951 | | |
1952 | | if constexpr (S == detail::enum_subtype::common) { |
1953 | | return !detail::cmp_less(value, min) && !detail::cmp_less(max, value); |
1954 | | } else { |
1955 | | if (value <= T{0}) { |
1956 | | return false; |
1957 | | } |
1958 | | |
1959 | | using U = detail::make_unsigned_t<T>; |
1960 | | const auto v = static_cast<U>(value); |
1961 | | if ((v & (v - U{1})) != U{0}) { |
1962 | | return false; |
1963 | | } |
1964 | | |
1965 | | const auto bit = detail::log2(v); |
1966 | | return !detail::cmp_less(bit, min) && !detail::cmp_less(max, bit); |
1967 | | } |
1968 | | } |
1969 | | #endif |
1970 | | } |
1971 | | |
1972 | | // Returns true if enum value can be reflected. |
1973 | | template <typename E, detail::enum_subtype S = detail::subtype_v<E>> |
1974 | | [[nodiscard]] constexpr auto enum_reflected(E value) noexcept -> detail::enable_if_t<E, bool> { |
1975 | | using D = std::decay_t<E>; |
1976 | | |
1977 | | return enum_reflected<D, S>(static_cast<underlying_type_t<D>>(value)); |
1978 | | } |
1979 | | |
1980 | | // Returns true if enum value can be reflected. |
1981 | | template <detail::enum_subtype S, typename E> |
1982 | | [[nodiscard]] constexpr auto enum_reflected(E value) noexcept -> detail::enable_if_t<E, bool> { |
1983 | | return enum_reflected<std::decay_t<E>, S>(value); |
1984 | | } |
1985 | | |
1986 | | template <bool AsFlags = true> |
1987 | | inline constexpr auto as_flags = AsFlags ? detail::enum_subtype::flags : detail::enum_subtype::common; |
1988 | | |
1989 | | template <bool AsCommon = true> |
1990 | | inline constexpr auto as_common = AsCommon ? detail::enum_subtype::common : detail::enum_subtype::flags; |
1991 | | |
1992 | | namespace bitwise_operators { |
1993 | | |
1994 | | template <typename E, detail::enable_if_t<E, int> = 0> |
1995 | | constexpr E operator~(E rhs) noexcept { |
1996 | | using U = underlying_type_t<E>; |
1997 | | |
1998 | | if constexpr (std::is_same_v<U, bool>) { |
1999 | | return static_cast<E>(!static_cast<U>(rhs)); |
2000 | | } else { |
2001 | | return static_cast<E>(~static_cast<U>(rhs)); |
2002 | | } |
2003 | | } |
2004 | | |
2005 | | template <typename E, detail::enable_if_t<E, int> = 0> |
2006 | | constexpr E operator|(E lhs, E rhs) noexcept { |
2007 | | return static_cast<E>(static_cast<underlying_type_t<E>>(lhs) | static_cast<underlying_type_t<E>>(rhs)); |
2008 | | } |
2009 | | |
2010 | | template <typename E, detail::enable_if_t<E, int> = 0> |
2011 | | constexpr E operator&(E lhs, E rhs) noexcept { |
2012 | | return static_cast<E>(static_cast<underlying_type_t<E>>(lhs) & static_cast<underlying_type_t<E>>(rhs)); |
2013 | | } |
2014 | | |
2015 | | template <typename E, detail::enable_if_t<E, int> = 0> |
2016 | | constexpr E operator^(E lhs, E rhs) noexcept { |
2017 | | return static_cast<E>(static_cast<underlying_type_t<E>>(lhs) ^ static_cast<underlying_type_t<E>>(rhs)); |
2018 | | } |
2019 | | |
2020 | | template <typename E, detail::enable_if_t<E, int> = 0> |
2021 | | constexpr E& operator|=(E& lhs, E rhs) noexcept { |
2022 | | return lhs = (lhs | rhs); |
2023 | | } |
2024 | | |
2025 | | template <typename E, detail::enable_if_t<E, int> = 0> |
2026 | | constexpr E& operator&=(E& lhs, E rhs) noexcept { |
2027 | | return lhs = (lhs & rhs); |
2028 | | } |
2029 | | |
2030 | | template <typename E, detail::enable_if_t<E, int> = 0> |
2031 | | constexpr E& operator^=(E& lhs, E rhs) noexcept { |
2032 | | return lhs = (lhs ^ rhs); |
2033 | | } |
2034 | | |
2035 | | } // namespace magic_enum::bitwise_operators |
2036 | | |
2037 | | } // namespace magic_enum |
2038 | | |
2039 | | #if defined(__clang__) |
2040 | | # pragma clang diagnostic pop |
2041 | | #elif defined(_MSC_VER) |
2042 | | # pragma warning(pop) |
2043 | | #endif |
2044 | | |
2045 | | #undef MAGIC_ENUM_GET_ENUM_NAME_BUILTIN |
2046 | | #undef MAGIC_ENUM_GET_TYPE_NAME_BUILTIN |
2047 | | #undef MAGIC_ENUM_CALLING_CONVENTION |
2048 | | #undef MAGIC_ENUM_VS_2017_WORKAROUND |
2049 | | #undef MAGIC_ENUM_ARRAY_CONSTEXPR |
2050 | | #undef MAGIC_ENUM_FOR_EACH_256 |
2051 | | #undef MAGIC_ENUM_DETAIL_USE_STD_REFLECTION |
2052 | | |
2053 | | #endif // NEARGYE_MAGIC_ENUM_HPP |