Flow is a modern C++ data structure library that provides high-performance allocator-awared containers as an extension to the STL.
-
β‘ Allocator-aware containers
Fully supports custom allocators (default to polymorphic allocators) across all core containers. -
π¦ Modular & Lightweight
Minimal dependencies with header only implementation. -
π§ Custom Memory Resources
Includes arena and monotonic memory resources to improve allocation performance and reduce fragmentation. -
β Extensive Unit Testing
Uses GoogleTest to validate correctness and performance across all major components.
Click Here >> API documentation generated by Doxygen.
| Class | Description |
|---|---|
| Container | |
Vector |
A dynamic array container with customizable allocator and growth strategy. Uses PolymorphicAllocator by default. |
BinaryHeap |
A binary min heap container with customizable allocator. Uses PolymorphicAllocator by default. |
DisjointSet |
A disjoint set with path compresssion and union by rank optimization. |
SegmentTree |
A segment tree that supports logarithmic point update and range query. |
NonTypeList |
A compiled-time homogeneous value list. |
| Memory | |
PolymorphicAllocator |
A polymorphic allocator that wraps around a non-owning memory resource. Memory allocation strategy is decided by the memory resource's implementation. |
DebugClass |
Debug class to track copy/move operations. Some operations may be optimized away in release builds. |
| β MemoryResource | |
β MemoryResource |
An abstract interface used by PolymorphicAllocator. Responsible for raw memory allocation and deallocation. |
β DefaultMemoryResource |
A default memory resource that wraps global ::operator new and ::operator delete. |
β ArenaMemoryResource |
A linear arena memory resource that allocates memory sequentially from a fixed buffer. Throws std::bad_alloc if there is insufficient space. |
β StackMemoryResource |
A stack-based memory resource that allocates memory in a LIFO order. Deallocation must happen in reverse order of allocation. |
β PoolMemoryResource |
A pool memory resource that manages fixed-size memory blocks from a pre-allocated buffer. Allocation must meet block size/alignment constraints. |
β BuddyMemoryResource |
A buddy-system memory resource that has logarithmic allocation complexity. |
| Concurrency | |
| β Container | |
β ConcurrentQueue |
A lock-based concurrency-safe FIFO queue. |
β ConcurrentFlexQueue |
A fine-grained lock-based concurrency-safe FIFO queue. |
β WorkStealingQueue |
A lock-based concurrency-safe FIFO queue that supports stealing job from the back. |
| β Thread Pool | |
β SimpleThreadPool |
A simple thread pool with a fixed number of worker threads and a shared task queue. |
β MultiQueueThreadPool |
A work-stealing multiqueue threadpool. Each worker thread has a thread_local task queue and can steal from each other. |
| Iterator | |
β CountedValueViewIterator |
Iterator that returns a constant value a fixed number of times. Useful for creating a virtual range of repeated values without overhead. |
β IntegralIterator |
Iterator that iterates through a range of contiguous integers. Useful for creating a virtual range of contiguous values without overhead. |