A header-only library for high-performance data structures in C/C++.
Compatible with C99 / C++11 / MSVC. BSD 3-Clause.
| Container | File | Structure | Allocates? |
|---|---|---|---|
ccmap |
include/ccmap.h |
Intrusive red-black tree (ordered map) | No |
cchashmap |
include/cchashmap.h |
Intrusive chained hash map | Buckets |
cclink |
include/cclink.h |
Intrusive singly-linked list | No |
cclist |
include/cclist.h |
Intrusive doubly-linked list | No |
ccheap |
include/ccheap.h |
D-ary heap (priority queue) | Pointer array |
ccvector |
include/ccvector.h |
Dynamic array | Yes |
ccflatmap |
include/ccflatmap.h |
Sorted-array map (flat map) | Yes |
cctreap |
include/cctreap.h |
Intrusive treap (order statistics) | No |
ccrandom |
include/ccrandom.h |
PRNG (Xoroshiro128++ / Xoshiro256** / Xoshiro512**) | No |
ccunicode |
include/ccunicode.h |
UTF-8 ↔ UCS-4 codec | No |
ccshuffle |
include/ccshuffle.h |
Fisher-Yates shuffle | No |
ccbits |
include/ccbits.h |
Bit manipulation (popcount, clz, ctz, rotate, bswap, bitrev) | No |
Most containers are intrusive — nodes are embedded in user structs, no hidden allocations. ccvector and ccflatmap store elements by value.
#include <stdio.h>
#include "ccmap.h"
struct entry { int key; ccmap_node_t node; };
static int64_t cmp(const ccmap_node_t *a, const ccmap_node_t *b) {
return (int64_t)CCMAP_CONTAINER(a, struct entry, node)->key
- (int64_t)CCMAP_CONTAINER(b, struct entry, node)->key;
}
int main() {
ccmap_t m; ccmap_init(&m, cmp);
struct entry e = {42};
ccmap_insert(&m, &e.node, NULL);
for (ccmap_node_t *n = ccmap_begin(&m); n; n = ccmap_next(n))
printf("%d\n", CCMAP_CONTAINER(n, struct entry, node)->key);
}More examples → docs/getting-started.md.
Full API → docs/api-reference.md.
# Configure (artifacts in build/)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
# Build everything
cmake --build build
# Run unit tests
ctest --test-dir build -L unit --output-on-failure
# One-shot build + test
cmake --build build --target check
# Run benchmarks (C++ STL comparison)
cmake --build build --target benchSee docs/building.md for details and manual compilation.
Online documentation (only chinease)
BSD 3-Clause © CandyMi