A lightweight set of utility headers written in C++20.
Requirements
- CMake
- C++20 compiler (and stdlib)
Steps
- Clone repo to appropriate subdirectory, say
ktl
- Add library to project via:
add_subdirectory(ktl)
andtarget_link_libraries(foo ktl::ktl)
- Use desired headers via
#include <ktl/header.hpp>
FIFO queue with thread safe "sleepy" API.
Features:
- Policy customization
- Multiple queues
- Thread-safe push-and-notify (to any desired queue)
- Thread-safe wait-and-pop (from first of any desired queues)
- Clear all queues and return residue
- Deactivate all queues (as secondary wait condition)
Async operation / shared state wrappers, with .then()
support.
Callable wrapper that cannot be copied, only moved. Used in kpackaged_task
and kfuture
.
std::thread
wrapper that joins on destruction / move, and supports stop_t
tokens.
Basic and strict wrappers for a T
and its (mutable) mutex, stdlib RAII lock types.
Aliases of tmutex
with std::shared_mutex
.
Wrapper around an integral type used as bit flags.
Free functions for working with integral bit flags.
Lightweight, resizeable wrapper over std::unique_ptr<std::byte[]>
.
x86/x64 debugger trap/break.
Tagged observer store with RAII signals.
RAII union of two types.
Wrapper for indexed iteration over ranges represented by pairs of iterators.
Union of expected and unexpected types; uses either.hpp
.
First-In First-Out map.
Fixed-size type erased storage.
Fixed-size vector-like container using bytearray as storage.
Lightweight hash-table with open addressing and reduced iterator stability.
Lightweight fmt-like std::string
interpolation with basic formatting support.
Lightweight unique pointer to heap-allocated Type*.
Semantic version.
Wrapper over an (un)ordered map that associates each T with a unique RAII handle which can be used to unregister the instance.
Models a "forward" N-tree (no parent link) via std::forward_list
.
Wrapper for raw / smart pointers that is restricted from being null.
Rotating ring-buffer using contiguous storage (std::vector<T>
by default). Overwrites on overflow.
Fixed-size rotating integral counter. Supports increment/decrement.
Pull/merge requests are welcome.