C++ Metaprogramming

Open-source C++ projects categorized as Metaprogramming

Top 23 C++ Metaprogramming Projects

Metaprogramming
  1. Magic Enum C++

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

  2. JetBrains

    Tell us how you use coding tools. You may win a prize! Are you a developer or a data analyst? Share your thoughts about your coding tools in our short survey and get a chance to win prizes!

    JetBrains logo
  3. Nameof C++

    Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum

  4. hana

    Your standard library for metaprogramming

  5. sml

    C++14 State Machine library

    Project mention: Show HN: CXXStateTree – A modern C++ library for hierarchical state machines | news.ycombinator.com | 2025-07-06

    Looks like SML is using user-defined literals [0, 1] to effectively pre-process the string literal into state/event objects. Looks like the string itself is turned into a template parameter in the process and I believe those shouldn't show up in the compiled code (maybe unless there's some mangling-related thing going on?)

    [0]: https://en.cppreference.com/w/cpp/language/user_literal.html

    [1]: https://github.com/boost-ext/sml/blob/f232328b49adf708737bef...

  6. Experimental Boost.DI

    C++14 Dependency Injection library

  7. refl-cpp

    Static reflection for C++17 (compile-time enumeration, attributes, proxies, overloads, template functions, metaprogramming).

    Project mention: Abusing C to Implement JSON Parsing with Struct Methods | news.ycombinator.com | 2025-03-01

    It's definitively different than Frunk, the library is not a general-purpose functional toolkit. One could certainly implement it with Zig's compile-time reflection with ease (don't know much about D). Actually, it's superficially similar to refl-cpp's serialization example [1], but with far less templating magic underneath due to the restricted scope.

    [1] https://github.com/veselink1/refl-cpp/blob/master/examples/e...

  8. te

    C++17 Run-time Polymorphism (Type Erasure) library

  9. Sevalla

    Deploy and host your apps and databases, now with $50 credit! Sevalla is the PaaS you have been looking for! Advanced deployment pipelines, usage-based pricing, preview apps, templates, human support by developers, and much more!

    Sevalla logo
  10. feelpp

    :gem: Feel++: Finite Element Embedded Language and Library in C++

  11. lwlog

    Very fast synchronous and asynchronous C++17 logging library

    Project mention: C++ logging library – something I've been working on | news.ycombinator.com | 2025-01-01
  12. jni-bind

    JNI Bind is a set of advanced syntactic sugar for writing efficient correct JNI Code in C++20 and up (or C++17 with clang).

  13. xl

    A minimalist, general-purpose programming language based on meta-programming and parse tree rewrites

  14. hsm

    Finite state machine library based on the boost hana meta programming library. It follows the principles of the boost msm and boost sml libraries, but tries to reduce own complex meta programming code to a minimum. (by erikzenker)

  15. protopuf

    Protocol Puffers: A little, highly templated, and protobuf-compatible serialization/deserialization header-only library written in C++20

  16. constexpr-sql

    Header only library that parses and plans SQL queries at compile time

  17. Tiger

    C++ Matrix -- High performance and accurate (e.g. edge cases) matrix math library with expression template arithmetic operators (by hosseinmoein)

  18. conjure_enum

    Lightweight header-only C++20 enum and typename reflection

  19. CppML

    A concise and readable metaprogramming language for C++

  20. kumi

    C++20 Compact Tuple Tools

  21. mlib

    mlib is a fast, simple c++ meta-programming library that uses c++20. (by robertshepherdcpp)

  22. zxorm

    Zach's ORM - A C++20 ORM for SQLite

  23. optimizing-the-memory-layout-of-std-tuple

    Optimizing the memory layout of std::tuple

  24. SpeciaLUT

    Runtime choosing of template specializations using compile-time lookup-tables. Compile all states of a template function, but execute the optimal one at runtime.

  25. static_string

    Experimental compile-time string manipulation C++17 library

  26. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020).

C++ Metaprogramming discussion

Log in or Post with

C++ Metaprogramming related posts

  • Abusing C to Implement JSON Parsing with Struct Methods

    4 projects | news.ycombinator.com | 1 Mar 2025
  • Out of bounds memory access in V8 in Google Chrome prior to 120.0.6099.224

    1 project | news.ycombinator.com | 25 Jan 2024
  • How does Swift implement primitive types in its standard library?

    2 projects | /r/ProgrammingLanguages | 22 Jun 2023
  • What's the most hilarious use of operator overloading you've seen?

    7 projects | /r/cpp | 6 May 2023
  • State machines with C++20 coroutines and Asio/Boost Async

    2 projects | /r/cpp_questions | 8 Apr 2023
  • When Debug Symbols Get Large

    2 projects | news.ycombinator.com | 9 Mar 2023
  • C++ Reflection for Component Serialization and Inspection

    3 projects | /r/gameenginedevs | 4 Mar 2023
  • A note from our sponsor - JetBrains
    surveys.jetbrains.com | 1 Sep 2025
    Are you a developer or a data analyst? Share your thoughts about your coding tools in our short survey and get a chance to win prizes! Learn more →

Index

What are some of the best open-source Metaprogramming projects in C++? This list will help you:

# Project Stars
1 Magic Enum C++ 5,645
2 Nameof C++ 2,229
3 hana 1,792
4 sml 1,272
5 Experimental Boost.DI 1,231
6 refl-cpp 1,167
7 te 488
8 feelpp 324
9 lwlog 306
10 jni-bind 297
11 xl 282
12 hsm 197
13 protopuf 186
14 constexpr-sql 141
15 Tiger 121
16 conjure_enum 77
17 CppML 60
18 kumi 54
19 mlib 46
20 zxorm 42
21 optimizing-the-memory-layout-of-std-tuple 33
22 SpeciaLUT 26
23 static_string 9

Sponsored
Tell us how you use coding tools. You may win a prize!
Are you a developer or a data analyst? Share your thoughts about your coding tools in our short survey and get a chance to win prizes!
surveys.jetbrains.com

Did you know that C++ is
the 7th most popular programming language
based on number of references?