Maze Builder Docs 8.10.23
Loading...
Searching...
No Matches
mazes::cell_pool Class Referencefinal

Reusable, lazily grown storage of cells. More...

#include <cell_pool.h>

Public Member Functions

 cell_pool (const cell_pool &)=delete
cell_pool & operator= (const cell_pool &)=delete
void acquire (std::uint8_t rows, std::uint8_t cols, std::uint8_t levels)
 Prepare rows * cols * levels cells, allocating only what the pool is missing. Every active cell is unlinked and assigned its (row, col) area.
void release () noexcept
 Unlink all active cells and deactivate them, keeping the allocated cells for reuse.
std::span< const std::shared_ptr< cell > > view () const noexcept
 Active cells in index order (level-major, then row, then column).
std::shared_ptr< cell > at (int index) const noexcept
 Active cell at a linear index, or nullptr.
int index_of (const cell *c) const noexcept
 Linear index of an active cell, or -1.
std::size_t size () const noexcept
std::size_t capacity () const noexcept

Detailed Description

Reusable, lazily grown storage of cells.

Member Function Documentation

◆ acquire()

void mazes::cell_pool::acquire ( std::uint8_t rows,
std::uint8_t cols,
std::uint8_t levels )

Prepare rows * cols * levels cells, allocating only what the pool is missing. Every active cell is unlinked and assigned its (row, col) area.

Note
Invalidates spans previously returned by view()

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