reloco

reloco (“Reliable Components”) is a header-only C++17 library of
Safety by Default replacements for Standard Library containers and value-lifetime
primitives. Anything that can fail — an out-of-bounds index, a use of a moved-from value, a
stale pointer — is rejected at compile time or returned as an explicit result<T> instead of
undefined behavior or an exception. It is meant for firmware, RTOS and interrupt code, crash
handlers and kernel-adjacent code.
Source and issue tracker: github.com/jplcz/reloco.
Where to start
New here? Read in this order: the Hardened containers guide explains the three-tier
(checked / try_ / unsafe_) access convention everything else follows, Lifetime safety
explains borrowed values, and Fallible construction explains how allocation failure is
reported. Then pick the container or primitive you need.
Safety model
- Hardened containers
- Lifetime safety
- Fallible construction
- Safety checker (
reloco-tidy) - Container contract
- Extending reloco
Containers
- Type-erased base containers
- Deque containers
- Ring buffers and lock-free SPSC ring buffers
- Balanced containers, tree containers, flat hash containers
- Linked containers
- Span slice operations, string operations, string view operations, tuple
Pointers, ownership and memory
- Unique pointer, intrusive pointers
- Trivial relocation, alignment
- Secure wipe
- Allocator capacity absorption
Concurrency
- Send/Sync, lock annotations, lock discipline
- Atomic context, futex backend, per-CPU slots, TLS slots
- Fault injection, coroutines