4#ifndef IT_D4NP_MEMORYPOOL_FREE_LIST_ITERATOR_HPP_
5#define IT_D4NP_MEMORYPOOL_FREE_LIST_ITERATOR_HPP_
28#if PBR_MEMORY_POOL_DIAGNOSTICS
35namespace it::d4np::memorypool {
51 using iterator_category = std::forward_iterator_tag;
52 using value_type =
const void*;
53 using difference_type = std::ptrdiff_t;
54 using pointer =
const value_type*;
55 using reference =
const value_type&;
64 [[nodiscard]] reference
operator*() const noexcept {
93 return current_ == rhs.current_;
98 return !(*
this == rhs);
103 const void* current_ =
nullptr;
141 return {pool_,
nullptr};
Read-only LegacyForwardIterator over the free-list slots.
const FreeListIterator operator++(int) noexcept
Post-increment; returns the pre-advance value.
FreeListIterator() noexcept=default
Construct the end sentinel.
reference operator*() const noexcept
bool operator!=(const FreeListIterator &rhs) const noexcept
Negation of operator==.
FreeListIterator & operator++() noexcept
Advance to the next free slot (ADR-0019 §2).
bool operator==(const FreeListIterator &rhs) const noexcept
Two iterators are equal iff they sit on the same slot (end == end).
pointer operator->() const noexcept
Lightweight read-only range over a pool's free list (ADR-0019 §3).
FreeListIterator begin() const noexcept
FreeListIterator end() const noexcept
FreeListView(const memory_pool_t *pool) noexcept
View the free list of pool (a C handle), or an empty range if NULL.
FreeListView(Pool &pool) noexcept
View the free list of pool — ergonomic overload for the C++ wrapper.
Owning, non-copyable, move-only wrapper around a memory_pool_t*.
Public C API for the pbr-cpp-memory-pool fixed-block-size allocator.
struct memory_pool memory_pool_t
Opaque handle to a memory pool instance.
const void * memory_pool_debug_free_list_head(const memory_pool_t *pool)
Diagnostics — return the head of pool's implicit free list (ADR-0019 §2).
const void * memory_pool_debug_free_list_next(const memory_pool_t *pool, const void *current)
Diagnostics — given a free slot current obtained from memory_pool_debug_free_list_head or a previous ...
C++17 RAII wrapper around the C memory pool.