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. Learn more →
Top 23 C++ no-dependency Projects
-
Catch
A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
-
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.
-
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.
-
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-08I'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
-
CLI11
CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.
The most feature-rich C++ CLI library is CLI11. Other popular choices include Boost.ProgramOptions, argparse, cxxopts and others.
-
Nameof C++
Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum
-
In my example the table stores the hash codes themselves instead of the keys (because the hash function is invertible)
Oh, I see, right. If determining the home bucket is trivial, then the back-shifting method is great. The issue is just that it’s not as much of a general-purpose solution as it may initially seem.
“With a different algorithm (Robin Hood or bidirectional linear probing), the load factor can be kept well over 90% with good performance, as the benchmarks in the same repo demonstrate.”
I’ve seen the 90% claim made several times in literature on Robin Hood hash tables. In my experience, the claim is a bit exaggerated, although I suppose it depends on what our idea of “good performance” is. See these benchmarks, which again go up to a maximum load factor of 0.95 (Although boost and Absl forcibly grow/rehash at 0.85-0.9):
https://strong-starlight-4ea0ed.netlify.app/
Tsl, Martinus, and CC are all Robin Hood tables (https://github.com/Tessil/robin-map, https://github.com/martinus/robin-hood-hashing, and https://github.com/JacksonAllan/CC, respectively). Absl and Boost are the well-known SIMD-based hash tables. Khash (https://github.com/attractivechaos/klib/blob/master/khash.h) is, I think, an ordinary open-addressing table using quadratic probing. Fastmap is a new, yet-to-be-published design that is fundamentally similar to bytell (https://www.youtube.com/watch?v=M2fKMP47slQ) but also incorporates some aspects of the aforementioned SIMD maps (it caches a 4-bit fragment of the hash code to avoid most key comparisons).
As you can see, all the Robin Hood maps spike upwards dramatically as the load factor gets high, becoming as much as 5-6 times slower at 0.95 vs 0.5 in one of the benchmarks (uint64_t key, 256-bit struct value: Total time to erase 1000 existing elements with N elements in map). Only the SIMD maps (with Boost being the better performer) and Fastmap appear mostly immune to load factor in all benchmarks, although the SIMD maps do - I believe - use tombstones for deletion.
I’ve only read briefly about bi-directional linear probing – never experimented with it.
-
Unless you want to make your own config file parser as an exercise (which is a good idea) I'd recommend using toml++.
-
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.
-
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-04I’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
-
UNITS
a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
-
unordered_dense
A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion
Project mention: unordered_dense: A Fast & Densely Stored Hashmap And Hashset Based On Robin-Hood Backward Shift Deletion | /r/programming | 2023-07-11 -
Project mention: nanoprintf VS callback_printf - a user suggested alternative | libhunt.com/r/nanoprintf | 2023-08-16
-
span-lite
span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
Project mention: I love building a startup in Rust. I wouldn't pick it again. | /r/programming | 2023-02-18Another solution: use std::span (or some alternative implementations if the codebase doesn't use C++20).
-
string-view-lite
string_view lite - A C++17-like string_view for C++98, C++11 and later in a single-file header-only library
Project mention: Is there a std::string::split or something similar? | /r/cpp_questions | 2023-03-13There are plenty of polyfill libraries that exist for std features like this. I strongly recommend using an existing one that attempts to match the standard closely. For example this one.
-
expected-lite
expected lite - Expected objects in C++11 and later in a single-file header-only library
Or nonstd::expected. Personally, I would rather use output parameters and an enum result or a std::variant over std::optional, because at the very least you have the option for more specific error diagnostics.
-
-
-
Example of other people trying to do it in a generic way, as a separate library (instead of in the utility part of some bigger codebase): - https://github.com/bitwizeshift/result - https://github.com/oktal/result - https://github.com/basicpp17/result17 - https://github.com/p-ranav/result
-
Project mention: uni-algo v0.7.0: constexpr Unicode library and some talk about C++ safety | /r/cpp | 2023-02-07
Safe layer is just bounds checks that work in all cases that I need, before that I was coping with -D_GLIBCXX_DEBUG (doesn't have safe iterators for std::string and std::string_view and that I need the most) and MSVC debug iterators (better but slow as hell in debug). You can read more about the implementation here: https://github.com/uni-algo/uni-algo/blob/main/doc/SAFE_LAYER.md Nothing interesting it's possible to implement all of this even in C++98 but no one cared back then and it's a shame that it's not in C++ standard so we cannot choose to use safe or unsafe std::string for example and must rely on implementations in compilers that are simply incomplete in many cases or implement it from scratch.
-
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)
Project mention: I'm a beginner making a library for unit conversion, contributions are welcome | /r/cpp | 2023-04-21Be sure to check this one, too https://github.com/aurora-opensource/au
-
-
-
ring-span-lite
ring-span lite - A C++yy-like ring_span type for C++98, C++11 and later in a single-file header-only library
-
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
C++ no-dependencies related posts
- `DestroyJavaVM()` failing on OpenJ9?
- [Cpp] Comment testez-vous la couverture du code C ++? Y a-t-il des solutions multiplateforme viables?
- Is there a std::string::split or something similar?
- If you limit an std::string in a class to be < 15 characters, can you assume that any time the string is read it will stay on the stack due to SSO?
- std::expected (with monadic interface) implementation in C++20 (P0323, P2505)
- GitHub - martinus/svector: Small Vector optimization
- C++ Return: std::any, std::optional, or std::variant?
-
A note from our sponsor - Onboard AI
getonboard.dev | 29 Nov 2023
Index
What are some of the best open-source no-dependency projects in C++? This list will help you:
Project | Stars | |
---|---|---|
1 | Catch | 17,299 |
2 | entt | 8,923 |
3 | Magic Enum C++ | 4,058 |
4 | CLI11 | 2,870 |
5 | Nameof C++ | 1,821 |
6 | robin-hood-hashing | 1,455 |
7 | tomlplusplus | 1,245 |
8 | refl-cpp | 955 |
9 | UNITS | 878 |
10 | unordered_dense | 592 |
11 | nanoprintf | 535 |
12 | span-lite | 475 |
13 | string-view-lite | 379 |
14 | expected-lite | 325 |
15 | leaf | 271 |
16 | semver | 265 |
17 | result | 236 |
18 | uni-algo | 224 |
19 | au | 181 |
20 | scope_guard | 154 |
21 | bredis | 148 |
22 | ring-span-lite | 145 |
23 | influxdb-cpp | 140 |