Hardcore metaprogramming in the wild

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • gadgetron

    Gadgetron - Medical Image Reconstruction Framework

  • The project is Gadgetron, which I will be the first to admit is not the easiest code base to dive into. Surprisingly, this is not due to any of the template shenanigans, just poor documentation.

  • json_struct

    json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • eventpp

    Event Dispatcher and callback list for C++

  • https://github.com/wqking/eventpp uses policy based design to configure behavior of its classes

  • vif

    Easy, robust, and fast numerics in C++. (by cschreib)

  • I wrote a C++11 n-dimensional array library for data analysis during my PhD https://github.com/cschreib/vif

  • slope

    Black box migration of data structures over RDMA (by farnasirim)

  • Mine is over at https://github.com/farnasirim/slope, code for my M. Sc. thesis. Main purpose was to make a C library RAII friendly. I wrote about it here: https://blog.farnasirim.com/2020/02/down-rabbit-hole-template-interface.html

  • MongoDB

    The MongoDB Database

  • It is probably easiest to understand if I describe it from the outside-inwards. So we have a YAML data file that describes all of our named error codes and assigns some of them in a many-to-many fashion to error categories. At the other end, users can catch ExceptionFor to catch a specific code, or ExceptionForCat to catch all errors in a given category. The yaml file is combined with some template files written using python's Cheetah3 to produce a header, a cpp, and a js file we use for testing.

  • unconstexpr-cpp20

    C++20 implementation of mutable constexpr expressions

  • Stateful metaprogramming via friend injections gives us the ability to capture and retrieve a compile time state. Thus, it is possible to create compile time counters, mutable constant expressions https://github.com/DaemonSnake/unconstexpr-cpp20, static reflection ```cpp template struct flag { friend consteval auto member_type(flag); };

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • lexy

    C++ parsing DSL

  • I've been going over lexy (https://github.com/foonathan/lexy) with that list in mind:

  • loki

    Discontinued A C++ Template library, developed by Andrei Alexandrescu, the author of the book Modern C++ Design. (by dutor)

  • vrm_pp

    Small C++ preprocessor library

  • I am using a combination of preprocessor metaprogramming (via my vrm_pp library and C++17 structured binding abuse (via Boost.PFR) to implement an auto-serializing/auto-deserializing networking protocol for my game, Open Hexagon. You can see the relevant code here:

  • SSVOpenHexagon

    C++20 FOSS clone of "Super Hexagon". Depends on SSVStart, SSVEntitySystem, SSVLuaWrapper, SSVMenuSystem, JSONcpp, SFML2.0. Features JSON/LUA customizable game files, a soundtrack by BOSSFIGHT, pseudo-3D effects.

  • seqan3

    The modern C++ library for sequence analysis. Contains version 3 of the library and API docs.

  • The SeqAn bioinformatics algorithms library includes quite advanced TMP. SeqAn basically provides an object oriented library of algorithms, but with compile-time (rather than runtime) dispatch. In other words, it implements compile-time OOP.

  • sol2

    Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:

  • Next to some already said examples: sol2 v3.0 https://github.com/ThePhD/sol2 - a Lua to C++ "header only" bridge...

  • arduino_modern

    Modern C++ arduino library

  • cpp-sort

    Sorting algorithms & related tools for C++14

  • I've got that cursed piece of code where I use multiplication to affect overload resolution: https://github.com/Morwenn/cpp-sort/blob/develop/include/cpp-sort/adapters/hybrid_adapter.h

  • tight_pair

    A compressed pair for C++17

  • There's also this doomed project with lots of metaprogramming and weird tricks where it took me more than 1500 lines of code to implement a slightly optimized compressed pair: https://github.com/Morwenn/tight_pair

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts