ZXFoundation™ 26h2
Loading...
Searching...
No Matches
lib.idalloc Module Reference

Data Structures

class  lib::id_allocator< MaxIds >
 Fixed-capacity SMP-safe ID allocator backed by a bitmap. More...

Functions

auto alloc () noexcept -> std::optional< u32 >
 Allocate the lowest available ID.
auto count () const noexcept -> u32
 Number of currently allocated IDs.
auto free (u32 id) noexcept -> void
 Free a previously allocated ID.
auto is_allocated (u32 id) const noexcept -> bool
 Check if an ID is currently allocated.
auto reserve (u32 n) noexcept -> void
 Reserve IDs [0, n). These will never be returned by alloc().

Variables

static constexpr u32 capacity = static_cast<u32>(MaxIds)
 Maximum capacity.

Files

file  lib/idalloc.cxxm
 Fixed-capacity SMP-safe ID allocator backed by a bitmap.