# Neargye/magic_enum

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

Repository: https://github.com/Neargye/magic_enum
Canonical: https://ross.abutalabs.com/products/magic_enum
Language: C++
License: MIT
License Family: permissive
Topics: cplusplus, cplusplus-17, c-plus-plus, c-plus-plus-17, cpp, cpp17, enum-to-string, string-to-enum, serialization, reflection, metaprogramming, header-only, single-file, no-dependencies, enum
Last push: 2026-08-11T16:02:34+00:00

## Health v2 (maintenance only)
Score: 81/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 50, longevity 100
- inputs: {"age_days": 2713, "days_push": 22, "days_rel": 122, "gap_med": 535, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 6175, forks 567 (observed 2026-08-28T04:09:37.446654+00:00)

## What it is
A header-only C++17 library providing static reflection for enums, enabling conversion between enum values and strings, iteration over enum values, and related utilities without macros or boilerplate. It works with any enum type using compiler-based metaprogramming techniques.

## Use cases
- convert enum value to its name string in C++
- parse a string into an enum value
- iterate over all values of an enum type
- get the count of enum entries at compile time
- serialize enums to text for logging or config files
- case-insensitive enum name lookup

## When to choose
- you need enum-to-string or string-to-enum conversion in modern C++ without writing macros
- you want a zero-dependency, single-header library you can drop into any project
- you need to iterate or reflect over enum values generically
- you want compile-time enum utilities with no runtime registration

## When to avoid
- your enums have very large or sparse value ranges that exceed the library's default limits
- you need full runtime reflection beyond enums
- you are stuck on a pre-C++17 compiler
- you cannot tolerate the template-heavy compile-time cost in large translation units

## Facets
- artifact type: library
- maturity: stable
- function: serialization, developer-tools
- domain: developer-tools, programming-languages
- platform: cpp, cross-platform
- tags: header-only, reflection, enums, metaprogramming, enum-to-string, string-to-enum, no-dependencies

## Member repositories
- Neargye/magic_enum (main) score 81

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:37.446654+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:47:25.880916+00:00, confidence not recorded.
  - readme: https://github.com/Neargye/magic_enum (fetched 2026-08-28T04:09:37.446654+00:00, sha 53d7585af996)
- Data as of 2026-08-30T08:39:29.467469+00:00.
