C++ header-only

Open-source C++ projects categorized as header-only

Top 23 C++ header-only Projects

  • json

    JSON for Modern C++

    Project mention: JSON for Modern C++ 3.11.3 (first release since 473 days) | /r/cpp | 2023-11-30
  • spdlog

    Fast C++ logging library.

    Project mention: Blackbox library for embedded systems | /r/cpp_questions | 2023-06-07
  • 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.

  • cpp-httplib

    A C++ header-only HTTP/HTTPS server and client library

    Project mention: Experience using crow as web server | /r/cpp | 2023-11-06

    Alternatives at the low to medium level of abstraction include civetweb and mongoose, which have a common ancestor. Both of these appear to be C rather than C++, but seem to be production quality and well-documented. Another C library is cpp-httplib, which is probably too low-level for me.

  • entt

    Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

    Project mention: Focus: A simple and fast text editor written in Jai | news.ycombinator.com | 2023-09-02

    https://pastebin.com/VPypiitk This is a very small experiment i did to learn the metaprogramming features. its an ECS library using the same model as entt (https://github.com/skypjack/entt). In 200 lines or so it does the equivalent of a few thousand lines of template heavy Cpp while compiling instantly and generating good debug code.

    Some walkthrough:

    Line 8 declares a SparseSet type as a fairly typical template. its just a struct with arrays of type T inside. Next lines implement getters/setters for this data structure

    Line 46 Base_Registry things get interesting. This is a struct that holds a bunch of SparseSet of different types, and providers getters/setters for them by type. It uses code generation to do this. The initial #insert at the start of the class injects codegen that creates structure members from the type list the struct gets on its declaration. Note also how type-lists are a native structure in the lang, no need for variadics.

    Line 99 i decide to do variadic style tail templates anyway for fun. I implement a function that takes a typelist and returns the tail, and the struct is created through recursion as one would do in cpp. Getters and setters for the View struct are also implemented through recursion

    Line 143 has the for expansion. This is how you overload the for loop functionality to create custom iterators.

    The rest of the code is just some basic test code that runs the thing.

  • GLM

    OpenGL Mathematics (GLM)

    Project mention: C++23: The Next C++ Standard | news.ycombinator.com | 2023-07-11
  • Crow

    Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

    Project mention: VueJS goes to microcontroller firmware. This website runs in ESP32 board, with frontend is made with VueJS, TailwindCSS and backend is written in C++. | /r/vuejs | 2023-04-14

    I did something similar in the past and used https://github.com/ipkn/crow as web server, in case you want to not implement the web part yourself. Otherwise amazing job!

  • GuiLite

    ✔️The smallest header-only GUI library(4 KLOC) for all platforms

    Project mention: [Cpp] Une assez grande liste de bibliothèques graphiques C ++ | /r/enfrancais | 2023-02-14


  • Onboard AI

    Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.


    Features: - Functional style. Inspired by [1] and React - Simple and elegant syntax (in my opinion). - Support for UTF8 and fullwidth chars (→ 测试). - No dependencies. - Cross platform. Linux/mac (main target), Windows (experimental thanks to contributors), - WebAssembly. - Keyboard & mouse navigation. Operating systems: - linux emscripten - linux gcc - linux clang - windows msvc - mac clang

    Project mention: Library for NES style terminal game. | /r/cpp_questions | 2023-09-30

    Background: I want to make a NES Tetris) clone for the terminal, with full resolution, this is achievable through using this ▀ character, and defining back and foreground color. This would result in a 1x2 pixel and by making the game width 256x120 characters this would provide full resolution. I made some tests, creating my own encoding for the different sprites and optimizing everything, which resulted in very quick printing times, even with a normal terminal. Nearly fast enough for the full 60Hz that the NES has, when printing the whole screen. The fact that i don't need to reprint the background (except maybe a tetris), makes 60Hz a kinda realistic goal. My main concern is, that there could occur kind of a screen tearing effect, which i really want to avoid. AFAIK, ncurses has a way to print the whole "window" with a function call to avoid this issue, however I had a lot of issues when trying to use ncurses to print the entire background and figured, that there are better alternatives. I also tried FTXUI and whilst the experience of giving each "pixel" a fore- and background color was much better, i didn't quite find a way to refresh the screen like ncurses. (i think there is some kind of way with the ScreenInteractive class, but i didn't get that to work, and it seemed like there was not a way to color each pixel. with InteractiveScreen you can make your own components with the whole "text()" thing, but this isn't really what i need)

  • doctest

    The fastest feature-rich C++11/14/17/20/23 single-header testing framework

    Project mention: Unit testing tool suggestions | /r/learnprogramming | 2023-05-07

    I have never used "tools" for unit-tests, only web sites that show the results of the tests or code coverage. For C++ I prefer https://github.com/doctest/doctest but most companies I worked for use Catch2.

  • 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

  • compile-time-regular-expressions

    Compile Time Regular Expression in C++

    Project mention: Compile time regular expression in C++ | news.ycombinator.com | 2023-09-12
  • indicators

    Activity Indicators for Modern C++

  • Crow

    A Fast and Easy to use microframework for the web. (by CrowCpp)

    Project mention: Experience using crow as web server | /r/cpp | 2023-11-06

    I'm investigating using C++ to build a REST server, and would love to know of people's experiences with Crow-- or whether they would recommend something else as a "medium-level" abstraction C++ web server. As background, I started off experimenting with Python/FastAPI, which is great, but there is too much friction to translate from pybind11-exported C++ objects to the format that FastAPI expects, and, of course, there are inherent performance limitations using Python, which could impact scaling up if the project were to be successful.

  • argparse

    Argument Parser for Modern C++

    Project mention: Command line interface library | /r/Cplusplus | 2023-03-24

    The most feature-rich C++ CLI library is CLI11. Other popular choices include Boost.ProgramOptions, argparse, cxxopts and others.

  • palanteer

    Visual Python and C++ nanosecond profiler, logger, tests enabler

  • plog

    Portable, simple and extensible C++ logging library

    Project mention: Fully Permissive License C++ Logger For Embedded System | /r/embedded | 2023-06-28
  • FunctionalPlus

    Functional Programming Library for C++. Write concise and readable C++ code.

    Project mention: Leaving Haskell Behind | news.ycombinator.com | 2023-08-24

    Hoogle is really amazing!

    Inspired by it, I implemented something similar for FunctionalPlus (a functional-programming library for C++): https://www.editgym.com/fplus-api-search/

    I'd love to see more projects taking this path too. :)

  • Nameof C++

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


    Parsing Expression Grammar Template Library

    Project mention: Show HN: Matcheroni, a tiny C++20 header library for building lexers/parsers | news.ycombinator.com | 2023-07-06

    Very cool, and I like the name!

    I'd be interested in reading about how Matcheroni compares with PEGTL and Lexy.


  • cppzmq

    Header-only C++ binding for libzmq

    Project mention: Question regarding method definition and .lib files | /r/AskProgramming | 2022-12-02

    I found that I knew almost nothing about C++ and had to start reading and watching tutorials to understand what was happening in the code samples provided. In the end, I just followed the C++ SDK programming manual and managed to capture the image data with the provided library and source code and display it with OpenCV. But even though this manual made it possible to display the video images, I am still very confused about the implementation of the member functions of the provided classes. And since I want to share the image data with a Python script, I need to understand exactly what is happening. Since I couldn't find any simple enough resources on shared memory, I tried sending the image data over sockets using the ZeroMQ library library called cppzmq.

  • uvw

    Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!

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

  • mio

    Cross-platform C++11 header-only library for memory mapped file IO (by vimpunk)

    Project mention: Is there a good cross-platform (Windows / Linux) C or C++ library for file I/O? | /r/cpp | 2023-02-04

    As simple and clean example you can see https://github.com/mandreyel/mio readme.md

  • SaaSHub

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

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-11-30.

C++ header-only related posts


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

Project Stars
1 json 37,810
2 spdlog 20,728
3 cpp-httplib 10,787
4 entt 8,923
5 GLM 8,130
6 Crow 7,308
7 GuiLite 6,964
8 FTXUI 5,476
9 doctest 5,307
10 Magic Enum C++ 4,064
11 compile-time-regular-expressions 3,033
12 indicators 2,674
13 Crow 2,354
14 argparse 2,108
15 palanteer 2,016
16 plog 1,967
17 FunctionalPlus 1,905
18 Nameof C++ 1,827
19 PEGTL 1,789
20 cppzmq 1,728
21 uvw 1,688
22 hana 1,583
23 mio 1,554
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives