RADLib
RADical C++ application framework
RADDataStructures

RADDataStructures provides RAD-owned C++20 containers for applications that need predictable allocation behavior, compact storage, and cache-conscious data layout. Everything lives in the RADData namespace and is header-only.

RADVector is the contiguous growable array used on RADLib hot paths, and RADSmallVector<T, InlineN> keeps its first InlineN elements inline before falling back to the heap. RADRingBuffer is a power-of-two circular buffer with push/pop at both ends, and it backs the RADQueue FIFO adapter; RADStack is a LIFO adapter over RADVector. RADSpscQueue is a lock-free, bounded single-producer/single-consumer queue with try_push()/try_pop() for thread-to-thread handoff without mutexes.

For associative storage, RADFlatHashMap is an open-addressed, cache-local hash map with tombstone-aware probing, and RADFlatHashSet is built on top of it. RADList is a stable-node doubly linked list for cases where element addresses must not move. RADByteArray and the non-owning RADArrayView (aliased as RADByteArrayView/RADConstByteArrayView) cover raw byte storage and views.

Allocation strategy is pluggable. RADMonotonicArena is a bump allocator for short-lived allocations that reset()s in one step; RADFixedPool hands out same-size blocks; and the standard-compatible RADMonotonicAllocator and RADAlignedAllocator let the containers above draw from an arena or an aligned heap.

Core features

  • RADVector and inline-storage RADSmallVector<T, InlineN> contiguous arrays.
  • RADRingBuffer double-ended ring with RADQueue/RADStack adapters.
  • Lock-free bounded RADSpscQueue for one-producer/one-consumer handoff.
  • RADFlatHashMap/RADFlatHashSet open-addressed associative containers.
  • Stable-node RADList, plus RADByteArray/RADArrayView byte storage.
  • RADMonotonicArena, RADFixedPool, and STL-compatible allocators.

RADLib public APIs remain STL-compatible in the beta SDK, so these containers are optional for application code. Use them where their allocation and layout properties are a better fit than the standard library containers.

Example:

RADData::RADMonotonicArena arena(64 * 1024);
ids.reserve(256);
ids.push_back(42);
counts["frames"] += 1;
if (const int* frames = counts.find("frames")) {
pending.try_push(*frames);
}
arena.reset(); // drops every arena-backed allocation at once
Open-addressed flat hash map optimized for cache-local lookups.
Definition: RADDataStructures.h:1098
V * find(const K &key)
Returns pointer to mapped value for key, or nullptr when absent.
Definition: RADDataStructures.h:1266
Standard-compatible allocator backed by RADMonotonicArena.
Definition: RADDataStructures.h:193
Simple monotonic arena for short-lived allocations.
Definition: RADDataStructures.h:124
Lock-free single-producer/single-consumer bounded queue.
Definition: RADDataStructures.h:1021
Contiguous dynamic array optimized for RADLib hot paths.
Definition: RADDataStructures.h:279