Library

magic_enum v0.10.0

Versionv0.10.0
Stars★ 6,256
Released2026-11-25

Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code

Release notes

# v0.10.0

See the [migration guide](https://github.com/Neargye/magic_enum/blob/v0.10.0/doc/migration.md) for upgrade steps and compatibility options.

## Breaking changes

- **Minimum versions:** C++17, GCC 9, Clang 9, Xcode 11, MSVC 19.20 / Visual Studio 2019, CMake 3.22, ReSharper C++ and CLion Nova 2025.3.
- **Automatic flags:** an enum with ADL `operator|` and `operator&` returning the enum is now reflected as flags. Names, counts and indices can change, and named combinations can fail to compile. Set `is_flags = false` for one enum or define `MAGIC_ENUM_NO_AUTO_IS_FLAGS` for the whole build, see [flags limitations](https://github.com/Neargye/magic_enum/blob/v0.10.0/doc/limitations.md#enum-flags).
- **Flag values:** flags include a named zero and the sign bit of signed enums (#321, #378). Zero participates in counts and iteration, and its name is used for formatting and parsing.
- **C++26 standard reflection:** used automatically when available. It ignores the scan range and uses the first declared name for aliases, so counts, indices and names can change. Define `MAGIC_ENUM_FORCE_COMPILER_SPECIFIC_REFLECTION` to keep the previous backend.
- **Validation:** integer lookups reject values outside the underlying type, for example `enum_cast<E>(257)` for a `uint8_t` enum is empty. Name customization can rename or hide declared values, but not add them.
- **New compile errors:** some named values just outside the scan range, non-integer arguments, explicit `E&` with rvalues, a custom name for an undeclared zero, a non-bool `is_flags`, `std::format` of `std::byte` with `MAGIC_ENUM_NO_CHECK_REFLECTED_ENUM`, and both `MAGIC_ENUM_NO_ASSERT` and `MAGIC_ENUM_ASSERT` defined.
- **Bitwise operators:** `magic_enum.hpp` no longer provides them, include `magic_enum_bitwise.hpp`.
- **Customization:** ADL hooks must be declared in the enum's namespace. `adl_info()` leaves flags detection automatic, read the mode with `is_flags_enum_v<E>` instead of `enum_range<E>::is_flags`. `customize_t` has `tag` and `name` fields instead of inheriting `std::pair`.
- **Containers:** `set<E>(mask)` is now `set<E>::from_mask(mask)`. The `bitset` string constructor is now `(sv, sep, cmp)`, and for flags, zero and combinations are masks, not positions. Equivalent keys keep `enum_values` order, so stored indices can change. `set` throws for unknown values and compares lexicographically.
- **`enum_switch`:** returns results by value, also for reference result types (#477).
- **`enum_type_name`:** unnamed enums need a typedef name or name customization (#128).
- **`enum_reflected`:** checks whether a value can be reflected at all, regardless of its name: within the scan range for common enums, any representable value with standard reflection, and zero or a single bit for flags.
- **Output:** unnamed values with a character underlying type are streamed as numbers. With fmt, an enum with its own `format_as` overload is formatted by it (#485).
- **Module:** `{fmt}` support is no longer detected automatically. Set `MAGIC_ENUM_MODULE_WITH_FMT=ON`, or define `MAGIC_ENUM_USE_FMT_HEADER` when building the module without CMake.
- **Removed macros:** `MAGIC_ENUM_SUPPORTED_ALIASES`, `MAGIC_ENUM_ENABLE_HASH_SWITCH`.

## New features

- `enum_min` and `enum_max` return the minimum and maximum reflected values (#462).
- `is_flags_enum` and `is_flags_enum_v` report the default mode (#447).
- `MAGIC_ENUM_DEFINE_BITWISE_OPERATORS(E)` and `MAGIC_ENUM_DEFINE_IOSTREAM_OPERATORS(E)` define operators for one enum (#434). Friend variants cover private nested enums and class templates.
- Options for the whole build: `MAGIC_ENUM_NO_AUTO_IS_FLAGS`, `MAGIC_ENUM_NO_NAMED_ZERO_IN_FLAGS`, `MAGIC_ENUM_NO_CHECK_OUT_OF_RANGE`, `MAGIC_ENUM_NO_CHECK_MULTIBIT_FLAGS`, `MAGIC_ENUM_REQUIRE_STD_REFLECTION`, `MAGIC_ENUM_NO_STD_FORMAT` and `MAGIC_ENUM_NO_FMT_FORMAT`.
- Custom string results for `enum_flags_name` and `bitset::to_string`, with constexpr support when the string…

Share this resource


Discovered 2026-11-27 Source GitHub Archive 2026-11 →