C89
data structure headers that use compile-time polymorphism to
generate lightweight and statically type-safe containers.
Pick and choose from src
and use them. Here are the dependencies.
Or just download the entire src
directory and put it where it's
convenient to reference from one's code. Parameters in each project
are pre-processor macros. Documentation is in doc/
and examples
are in test/
.
The somewhat separate orcish
project is used to debug
and graph code; it translates the graphgobbledygook pointer addresses
into more semi-meaningful deterministic orc names.
The implementation is fairly standard. Some rationales of the more complex containers documented here.
memory pool | A slab-allocator for similar objects |
hash table | Allocation-conscious chained hash-table |
B-tree | Practical in-memory B-tree design |
trie | Compact binary prefix trees |
Uses C++17
feature __has_include
in box.h
to decide to include
optional features so that part of the header files work without the
full thing. If one's compiler is does not support C++17
(especially)
and one needs these features, try uncommenting the appropriate
lines.
The testing framework in test/
is much less multi-platform then
the headers in src/
, requiring C13
anonymous unions, assuming
a union
is in the usual order. The Makefile
provided assumes
the gcc
suite and uses clang
.
On a segmented memory model, pool
probably won't work reliably,
especially when one compiles with C90
.
(Especially) trie
hasn't been tested when CHAR_BIT ≠ 8
, as it
could be in C90
.
C90
requires identifiers to be a minimum of 31 significant initial
characters in an internal identifier or a macro name. If one's
compiler does the very minimum, it probably won't be enough to
differentiate all the private symbols. One may have to edit the
code to abbreviate.
Utf-8 everywhere. There are few places where this makes a difference,
but one may have to edit some files if working with ASCII-only
compilers. (Specifically, "…" in to_string
.)
2016 Neil Edelman, distributed under the terms of the MIT License.