magic_enum
« Back to VersTracker
Description:
Static reflection for enums (to string, from string, iteration) for modern C++
Type: Formula  |  Latest Version: 5@0  |  Tracked Since: Dec 28, 2025
Links: Homepage  |  formulae.brew.sh
Category: Developer tools
Tags: c++ reflection header-only enum metaprogramming
Install: brew install magic_enum
About:
Magic Enum provides static reflection for C++ enums, enabling operations like converting enumerators to strings and vice versa without macros or external code generation. It offers compile-time iteration over enum values, making it easy to implement serialization, logging, and UI binding. The library is header-only and leverages modern C++ features for zero-overhead abstractions.
Key Features:
  • Header-only library with no dependencies
  • Compile-time enum to string and string to enum conversion
  • Iteration over enum values at compile time
  • Support for scoped and unscoped enums
  • Works with standard C++11/14/17/20 compilers
Use Cases:
  • Serialization and deserialization of enum values
  • Logging and debugging with human-readable enum names
  • UI and configuration binding for enum types
  • Implementing reflection-based features without macros
Alternatives:
  • Boost.Enum – Boost provides reflection utilities but requires the heavy Boost library; Magic Enum is lightweight and header-only.
  • magic_get (PFR) – magic_get focuses on aggregate structures; Magic Enum is specialized for enum reflection.
Version History
Detected Version Rev Change Commit
Nov 16, 2024 11:33pm 5 0 VERSION_BUMP 32cc7150
Nov 16, 2024 5:20pm 5 0 VERSION_BUMP d908b639
Nov 3, 2024 2:07pm 0 VERSION_BUMP 690e0c05