|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Pointer table with index reuse for efficient pointer management. More...
Go to the source code of this file.
Classes | |
| class | Pointer_Table |
| A dynamic table for managing void pointers with index recycling. More... | |
Pointer table with index reuse for efficient pointer management.
This file provides Pointer_Table, a data structure that manages a dynamic collection of void pointers with automatic index recycling. When pointers are removed, their indices are tracked and reused for subsequent insertions, minimizing memory fragmentation and index growth.
The table uses a two-array approach:
pointer_table: Stores the actual pointers indexed by positionfree_table: Stack of available indices for reuseA heap_index tracks the "high water mark" - all indices below it have been used at some point. When removing the top pointer, the heap contracts automatically, releasing memory.
Definition in file pointer_table.H.