pbr-cpp-memory-pool 1.1.2
Fixed-block-size O(1) memory pool — C++17 with an ANSI C public surface
Loading...
Searching...
No Matches
it::d4np::memorypool::FreeListIterator Class Reference

Read-only LegacyForwardIterator over the free-list slots. More...

#include <free_list_iterator.hpp>

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = const void *
 
using difference_type = std::ptrdiff_t
 
using pointer = const value_type *
 
using reference = const value_type &
 

Public Member Functions

 FreeListIterator () noexcept=default
 Construct the end sentinel.
 
 FreeListIterator (const memory_pool_t *pool, const void *current) noexcept
 Construct an iterator positioned at current within pool's list.
 
reference operator* () const noexcept
 
pointer operator-> () const noexcept
 
FreeListIteratoroperator++ () noexcept
 Advance to the next free slot (ADR-0019 §2).
 
const FreeListIterator operator++ (int) noexcept
 Post-increment; returns the pre-advance value.
 
bool operator== (const FreeListIterator &rhs) const noexcept
 Two iterators are equal iff they sit on the same slot (end == end).
 
bool operator!= (const FreeListIterator &rhs) const noexcept
 Negation of operator==.
 

Detailed Description

Read-only LegacyForwardIterator over the free-list slots.

Dereferencing yields the address of a free slot as const void*. Because that address is the iterator's own state, operator* returns a reference to the stored member — so the type is a genuine forward iterator (with the multi-pass guarantee), not an input-only proxy. The default- constructed iterator (current_ == nullptr) is the end sentinel.

Never mutate the storage a dereferenced pointer addresses — the surface is read-only by construction (ADR-0019 §3).

Definition at line 49 of file free_list_iterator.hpp.

Member Typedef Documentation

◆ iterator_category

using it::d4np::memorypool::FreeListIterator::iterator_category = std::forward_iterator_tag

Definition at line 51 of file free_list_iterator.hpp.

◆ value_type

using it::d4np::memorypool::FreeListIterator::value_type = const void*

Definition at line 52 of file free_list_iterator.hpp.

◆ difference_type

using it::d4np::memorypool::FreeListIterator::difference_type = std::ptrdiff_t

Definition at line 53 of file free_list_iterator.hpp.

◆ pointer

using it::d4np::memorypool::FreeListIterator::pointer = const value_type*

Definition at line 54 of file free_list_iterator.hpp.

◆ reference

using it::d4np::memorypool::FreeListIterator::reference = const value_type&

Definition at line 55 of file free_list_iterator.hpp.

Constructor & Destructor Documentation

◆ FreeListIterator()

it::d4np::memorypool::FreeListIterator::FreeListIterator ( const memory_pool_t pool,
const void *  current 
)
inlinenoexcept

Construct an iterator positioned at current within pool's list.

Definition at line 61 of file free_list_iterator.hpp.

Member Function Documentation

◆ operator*()

reference it::d4np::memorypool::FreeListIterator::operator* ( ) const
inlinenoexcept
Returns
The current free-slot address (by reference to iterator state).

Definition at line 64 of file free_list_iterator.hpp.

◆ operator->()

pointer it::d4np::memorypool::FreeListIterator::operator-> ( ) const
inlinenoexcept
Returns
Address of the current-slot-address member.

Definition at line 69 of file free_list_iterator.hpp.

◆ operator++() [1/2]

FreeListIterator & it::d4np::memorypool::FreeListIterator::operator++ ( )
inlinenoexcept

Advance to the next free slot (ADR-0019 §2).

Definition at line 74 of file free_list_iterator.hpp.

◆ operator++() [2/2]

const FreeListIterator it::d4np::memorypool::FreeListIterator::operator++ ( int  )
inlinenoexcept

Post-increment; returns the pre-advance value.

The const return is the cert-dcl21-cpp convention (prevents (it++)++ misuse); the readability-const-return-type check disagrees, so it is suppressed.

Definition at line 85 of file free_list_iterator.hpp.

◆ operator==()

bool it::d4np::memorypool::FreeListIterator::operator== ( const FreeListIterator rhs) const
inlinenoexcept

Two iterators are equal iff they sit on the same slot (end == end).

Definition at line 92 of file free_list_iterator.hpp.

◆ operator!=()

bool it::d4np::memorypool::FreeListIterator::operator!= ( const FreeListIterator rhs) const
inlinenoexcept

Negation of operator==.

Definition at line 97 of file free_list_iterator.hpp.


The documentation for this class was generated from the following file: