# aantron/better-enums

C++ compile-time enum to string, iteration, in a single header file

Repository: https://github.com/aantron/better-enums
Canonical: https://ross.abutalabs.com/products/better-enums
Homepage: http://aantron.github.io/better-enums
Language: C++
License: BSD-2-Clause
License Family: permissive
Topics: enum, cpp, reflection, header-only
Last push: 2024-02-10T16:50:13+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 4132, "days_push": 935, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1828, forks 182 (observed 2026-08-28T04:05:41.585139+00:00)

## What it is
Better Enums is a single-header C++ library that adds reflection to enums, enabling string conversion, iteration, and counting at compile time (C++11) or runtime (C++98). It uses a macro-based metaprogram executed by the compiler with no dependencies or generator tools.

## Use cases
- convert enum values to and from strings in C++
- iterate over all enum values
- parse a string into an enum safely
- count enum members at compile time
- use enums in constexpr functions and template metaprogramming
- replace unmaintainable enum-to-string switch statements

## When to choose
- you need reflective enums in C++ without code generation tools
- you want a zero-dependency, header-only solution
- you need compile-time enum reflection in C++11
- you target freestanding or embedded environments (no heap, no exceptions)

## When to avoid
- you need enums declared inside a class (macro limitation)
- you can use C++26 native reflection or a different enum approach
- you prefer non-macro-based enum libraries

## Facets
- artifact type: library
- maturity: stable
- function: serialization, developer-tools
- domain: developer-tools, programming-languages, parsers
- platform: cpp, cross-platform
- tags: header-only, enum, reflection, compile-time, metaprogramming, single-header

## Member repositories
- aantron/better-enums (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:41.585139+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-30T03:19:23.655550+00:00, confidence not recorded.
  - readme: https://github.com/aantron/better-enums (fetched 2026-08-28T04:05:41.585139+00:00, sha 7f73ec10c3a2)
  - homepage: http://aantron.github.io/better-enums (fetched 2026-08-29T10:58:13.711847+00:00, sha 54dbee744a70)
- Data as of 2026-08-30T08:39:29.467469+00:00.
