Half the memory for pointer-heavy C++
4-byte pointers and drop-in std containers for 64-bit C++,
on the same trick as V8's pointer compression. Header-only, C++20, MIT.
#include "cptr/all.hpp"
cptr::list<int> l; // was std::list<int>
cptr::ordered_map<int, int> m; // was std::map<int, int>
cptr::unordered_map<int, int> h; // was std::unordered_map<int, int>
cptr::ptr<node> n = cptr::make<node>(); // your own nodes: 4-byte pointers
Read more
WhyThe idea, what it buys, what it costs, and the alternatives.
GuideHow it works, every header, allocators, persistence, rules.
BenchmarksCompressed against raw pointers at p50 to p99.5; memory and latency for every container.
API referenceEvery public type and function, with a start page and examples.
Benchmark historyCompressed as % of raw pointers on every push to main.
Code coverageLine and branch coverage of the headers from the tests.