C++ compile-time

Open-source C++ projects categorized as compile-time

Top 20 C++ compile-time Projects

compile-time
  1. compile-time-regular-expressions

    Compile Time Regular Expression in C++

    Project mention: Show HN: Less Slow C++ | news.ycombinator.com | 2025-04-18

    The problem can occur in general if there is a greedy match within the regex: https://github.com/hanickadot/compile-time-regular-expressio...

    Although it looks like that this got fixed for simple patterns.

  2. 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
  3. lazy_importer

    library for importing functions from dlls in a hidden, reverse engineer unfriendly way

  4. xorstr

    heavily vectorized c++17 compile time string encryption.

  5. UNITS

    a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.

    Project mention: Python type hints may not be not for me in practice | news.ycombinator.com | 2024-11-27

    I suspect C++ still comes the closest to what you’re asking for today, at least among mainstream programming languages.

    Matrix dimensions are certainly doable, for example, because templates representing mathematical types like matrices and vectors can be parametrised by integers defining their dimension(s) as well as the type of an individual element.

    You can also use template wizardry to write libraries like mp-units¹ or units² that provide explicit representations for numerical values with units. You can even get fancy with user-defined literals so you can write things like 0.5_m and have a suitably-typed value created (though that particular trick does get less useful once you need arbitrary compound units like kg·m·s⁻²).

    Both of those are fairly well-defined problems and the solutions available do provide a good degree of static checking at compile time.

    IMHO, the range question is the trickiest one of your three examples, because in real mathematical code there are so many different things you might want to constrain. You could define a parametrised type representing open or closed ranges of integers between X and Y easily enough, but how far down the rabbit hole do you go? Fractional values with attached precision/error metadata? The 572 specific varieties of matrix that get defined in a linear algebra textbook, and which variety you get back when you compute a product of any two of them?

    ¹ https://mpusz.github.io/mp-units/

    ² http://nholthaus.github.io/units/

  6. ctpg

    Compile Time Parser Generator is a C++ single header library which takes a language description as a C++ code and turns it into a LR1 table parser with a deterministic finite automaton lexical analyzer, all in compile time.

  7. au

    A C++14-compatible physical units library with no dependencies and a single-file delivery option. Emphasis on safety, accessibility, performance, and developer experience. (by aurora-opensource)

  8. mp

    C++20 Meta-Programming library

    Project mention: C++20 – Back to the Future Meta-Programming | news.ycombinator.com | 2024-07-15

    The question is - Can we do better? And if so, what are the trade-offs? All in all, wouldn't be great to be able to write the same code for run-time and compile-time and/or debug compile-time code at run-time?

    Reflection for C++ - https://wg21.link/P2996 - introduced a new meta-programming model which is value/consteval based and can greatly improve the experience. Together with reflection is a very powerful combination but it also has its own set of trade-offs such as slower compilation-times.

    This post is about `mp` - https://github.com/boost-ext/mp - meta-programming library which supports - similar to P2996 - meta-programming model for easier transition as it supports C++20 (msvc, gcc, clang), has a bit faster compilation times than P2996, but mostly, it makes meta-programming a 'normal' C++. In the mp world no difference between run-time and compile-time, whole standard library can be leveraged and it has reflection integration with C++20 using https://github.com/boost-ext/reflect. Of course it has it own set of trade-offs but, IMHO, it has a lot of potential and it's super fan.

    > Example (API)

        // mp::meta

  9. SaaSHub

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

    SaaSHub logo
  10. pure_simd

    A simple, extensible, portable, efficient and header-only SIMD library!

  11. eternal

    A C++14 compile-time/constexpr map and hash map with minimal binary footprint (by mapbox)

  12. sml

    C++20 State Machine library (by qlibs)

  13. CTAsm

    Compile time assembler with nasm syntax

  14. static-functional

    Header-only C++ library providing compile-time functional operators that work with raw function pointers

  15. mlib

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

  16. uninttp

    A universal type for non-type template parameters for C++20 or later.

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

  18. enum_name

    Converting (scoped)enum values to string names written in C++>=11.

  19. compile_time_regexp.h

    A simple compile time dfa based regular expression library for C++20.

  20. static_string

    Experimental compile-time string manipulation C++17 library

  21. lambda-tuple

    An implementation of `std::tuple` based on variadic lambda capture

  22. typo

    C++ utility to get the name of type in a human-readable form (by AVasK)

  23. SaaSHub

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

    SaaSHub 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++ compile-time discussion

Log in or Post with

C++ compile-time related posts

  • C++20 – Back to the Future Meta-Programming

    2 projects | news.ycombinator.com | 15 Jul 2024
  • Force compiler to construct strings dynamically on the stack (win64)

    1 project | /r/cpp | 29 Dec 2022
  • Code criticism on decrypt function

    1 project | /r/cpp_questions | 21 Nov 2022
  • How to filter tuple at compile time, by values of its elements (instead of types) ?

    2 projects | /r/cpp | 8 Sep 2022
  • Is there a crossplatform way to write Simd?

    2 projects | /r/cpp_questions | 4 Apr 2022
  • Compile Time Parser Generator - 1.3.6

    1 project | /r/cpp | 3 Jan 2022
  • Compile Time Parser Generator

    1 project | /r/cpp | 22 Dec 2021
  • A note from our sponsor - SaaSHub
    www.saashub.com | 21 May 2025
    SaaSHub helps you find the best software and product alternatives Learn more →

Index

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

# Project Stars
1 compile-time-regular-expressions 3,551
2 lazy_importer 1,749
3 xorstr 1,306
4 UNITS 998
5 ctpg 472
6 au 362
7 mp 281
8 pure_simd 230
9 eternal 210
10 sml 209
11 CTAsm 78
12 static-functional 49
13 mlib 46
14 uninttp 27
15 SpeciaLUT 26
16 enum_name 21
17 compile_time_regexp.h 17
18 static_string 8
19 lambda-tuple 6
20 typo 2

Sponsored
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.
www.influxdata.com