A C++ compile-time enum library providing reflection, iteration, and string conversion in a single header file.
Better Enums is a C++ library that enhances standard enums with reflection capabilities, allowing developers to convert enums to strings, iterate over enum values, and perform compile-time queries. It solves the problem of C++ enums lacking built-in introspection and utility functions, providing a single-header solution without dependencies.
C++ developers working on projects that require robust enum handling, such as serialization, debugging, UI code, or metaprogramming, especially those using C++11 or needing compatibility with C++98.
Developers choose Better Enums for its clean syntax, compile-time efficiency, and cross-compiler support, offering a lightweight yet powerful alternative to manual enum utilities or heavier reflection libraries.
C++ compile-time enum to string, iteration, in a single header file
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables conversion to strings, iteration, and bounds checking at compile time in C++11, allowing for efficient metaprogramming with zero runtime overhead in optimized builds.
Just add enum.h to your project with no external dependencies, making integration trivial and reducing build system complexity.
Tested and works on clang, gcc, and msvc, ensuring reliable portability across different development environments and platforms.
Provides scoped and sized enums for C++98, bringing modern enum features like controlled representation to older codebases without requiring language upgrades.
Cannot be used directly inside class definitions, forcing workarounds like typedefs or namespace usage, which can complicate code organization.
Has a soft limit of 64 constants per enum, requiring manual extension for larger enumerations and potentially increasing maintenance burden.
In comparisons, constants often need explicit promotion with the + operator to avoid type issues, introducing subtle boilerplate and error risk.