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

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 39 minutes ago
Added to GitGenius on September 10th, 2026
Created on March 30th, 2019
Open Issues & Pull Requests: 16 (+0)
GitHub issues: Enabled
Number of forks: 567
Total Stargazers: 6,194 (+0)
Total Subscribers: 65 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 41.5 hours
Mean response time: 59.7 days
90th percentile: 109.2 days
Tracked items: 67

How this project is maintained

Around half of the issues opened in the past year never receive a reply. Only 6% of issues opened in the past year have been closed. Three people close 84% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 11
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 720 days
Stale 30+ days: 10
Stale 90+ days: 6

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • help wanted (9)
  • question (8)
  • enhancement (2)
  • good first issue (1)
  • needs more information (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Magic Enum is a header-only C++17 library that provides static reflection for enums, enabling conversion between enum values and strings, iteration, and type introspection without requiring macros or boilerplate code.

The library solves the problem of working with enums in C++ where standard language features offer no built-in way to convert between enum values and their string representations or to iterate over enum members. Magic Enum uses compile-time metaprogramming to reflect on enum types and generate the necessary conversion and introspection functions automatically. It requires only that you include the appropriate header and call the library's functions on your enum type; no registration, annotation, or code generation step is needed.

The tool suits any C++ project that needs to serialize enums to strings, parse strings back to enum values, or perform runtime operations like iteration or membership testing on enum types. It works with both scoped and unscoped enums and supports flag operations for bitwise enum types. The library integrates into existing build systems through CMake, vcpkg, Conan, Build2, Meson, Bazel, and ROS, and can be used as a header-only library or as a C++20 module. Developers should be aware of the enum range limitation documented in the project's limitations section, though compile-time enum-to-string conversion is available as an alternative that avoids this restriction.

The project maintains active development with regular updates addressing compiler compatibility and feature requests. The codebase supports a wide range of compiler versions including GCC 9 and later, Clang 5 and later, MSVC 2017 and later, and Xcode 10 and later. The library provides extensive integration options and optional features such as formatting support through the fmt library and C++20 module support with configurable standard library imports.