C++ Metaprogramming

Open-source C++ projects categorized as Metaprogramming

Top 23 C++ Metaprogramming Projects

  • 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

    Project mention: What C++ library do you wish existed but hasn’t been created yet? | /r/cpp | 2023-07-08

    I'm not sure this is quite what you're asking for, but this library has been super helpful to me in the past : https://github.com/Neargye/magic_enum

  • Nameof C++

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

    Project mention: Added reflection to C++ just to make my game work. | /r/gamedev | 2022-10-27

    In general, nameof for reflection

  • InfluxDB

    Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.

  • hana

    Your standard library for metaprogramming

    Project mention: What are some C++ projects with high quality code that I can read through? | /r/cpp_questions | 2023-01-16

    I like boost::hana. Wish I had more chances to use it at work.

  • Experimental Boost.DI

    DI: C++14 Dependency Injection Library

  • sml

    SML: C++14 State Machine Library

    Project mention: State machines with C++20 coroutines and Asio/Boost Async | /r/cpp_questions | 2023-04-08

    Hello all. Being a huge fan of state machine and coroutines, I have been browsing around for examples of what other people do combine these two. I have been using boost-ext/sml for quite many projects and are quite happy about that. But when transitioning to code that relies on coroutines, I would like to write entry/exit/actions/guard methods that uses coroutines and where I can co_await on awaitables from Asio and more recently "Boost Async".

  • refl-cpp

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

    Project mention: C++ Reflection for Component Serialization and Inspection | /r/gameenginedevs | 2023-03-04

    I’ve been using https://github.com/veselink1/refl-cpp for my recent project where i needed reflections, especially for serialization. Cant wait for c++48 and reflections in standard

  • proxy

    Proxy: Easy Polymorphism in C++ (by microsoft)

    Project mention: Static Interfaces, concepts vs de-virtualisation? | /r/cpp | 2023-03-24

    Proxy seems more likely than Dyno or AnyAny to be a standard way of doing this in C++'s future.

  • Mergify

    Updating dependencies is time-consuming.. Solutions like Dependabot or Renovate update but don't merge dependencies. You need to do it manually while it could be fully automated! Add a Merge Queue to your workflow and stop caring about PR management & merging. Try Mergify for free.

  • te

    TE: C++17 Run-time polymorphism (type erasure) library

    Project mention: rust-like traits on plain C++ with short macro (type erasure actually) | /r/cpp | 2023-04-07

    Or dyno or Poly or Not-Actually-Boost.TE or ...

  • feelpp

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

    Project mention: rodin alternatives - mfem and FreeFem-sources | libhunt.com/r/rodin | 2023-03-08
  • jni-bind

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

    Project mention: In 2023, what is the easiest recommended way to call a Java class from C++? Note that the opposite is easy through JNI, JNA or JNR. Now C++ calling Java has been historically hard. | /r/cpp_questions | 2023-04-29
  • 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)

  • lwlog

    Very fast synchronous C++17 logging library

  • protopuf

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

  • constexpr-sql

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

  • Matrix

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

    Project mention: Update on C++ Algo Trading/ Data Analysis tool | /r/algotrading | 2023-02-05

    Yes, I have. As matter of fact I have another open source (https://github.com/hosseinmoein/Matrix) that uses this technique.

  • CppML

    A concise and readable metaprogramming language for C++

  • mlib

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

    Project mention: New metaprogramming library called mlib | /r/cpp | 2023-02-20

    Hi! I have just finished most of my metaprogramming library called mlib. I think this is very useful as it is very small and has very powerful features, go and have a look! robertshepherdcpp/mlib: mlib is a fast, simple c++ meta-programming library that uses c++20. (github.com) .Here is an example snippet:

  • kumi

    C++20 Compact Tuple Tools

    Project mention: What's the most hilarious use of operator overloading you've seen? | /r/cpp | 2023-05-06

    operator"" can be used in a similar way to expression templates (DSLs), where the type of the resulting expression is dependent on the string contents. For example ctre makes use of this to build efficient regular expression parsers, and kumi uses this in conjunction with operator[] to make tuple indexing quite elegant

  • zxorm

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

    Project mention: Introducing ZXORM - A C++20 ORM for SQLite with Compile Time Type Safety | /r/cpp | 2023-03-30
  • optimizing-the-memory-layout-of-std-tuple

    Optimizing the memory layout of std::tuple

  • 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.

    Project mention: C++ Show and Tell - December 2022 | /r/cpp | 2022-12-02

    I made SpeciaLUT to convert bool/enum runtime tests to compile-time conditionals — by compiling all branching combinations in hot functions and saving them in a lookup-table, so the optimal one can be called at runtime. Reason: as an HPC consultant I encountered many codes that grew without good architecture, in which features would just be added and branching would propagate through all levels. This yields 10% to 50% performance increase in such codes.

  • crunchy-bytes

    C++ 17 Schema Serialization Library

  • static_string

    Experimental compile-time string manipulation C++17 library

  • SonarCloud

    Analyze your C and C++ projects with just one click.. SonarCloud, a cloud-based static analysis tool for your CI/CD workflows, offers a one-click automatic analysis of C and C++ projects hosted on GitHub. Zero configuration and free for open-source projects! Analyze free.

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). The latest post mention was on 2023-07-08.

C++ Metaprogramming related posts

Index

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

Project Stars
1 Magic Enum C++ 3,918
2 Nameof C++ 1,759
3 hana 1,563
4 Experimental Boost.DI 1,038
5 sml 976
6 refl-cpp 942
7 proxy 689
8 te 368
9 feelpp 282
10 jni-bind 173
11 hsm 172
12 lwlog 167
13 protopuf 136
14 constexpr-sql 128
15 Matrix 83
16 CppML 51
17 mlib 39
18 kumi 34
19 zxorm 29
20 optimizing-the-memory-layout-of-std-tuple 27
21 SpeciaLUT 26
22 crunchy-bytes 5
23 static_string 2
Analyze your C and C++ projects with just one click.
SonarCloud, a cloud-based static analysis tool for your CI/CD workflows, offers a one-click automatic analysis of C and C++ projects hosted on GitHub. Zero configuration and free for open-source projects! Analyze free.
www.sonarsource.com