|
pbr-cpp-memory-pool 1.1.2
Fixed-block-size O(1) memory pool — C++17 with an ANSI C public surface
|
Fluent builder for configured Pool instances.
More...
#include <memory_pool.hpp>
Public Member Functions | |
| PoolBuilder & | with_block_size (std::size_t block_size) noexcept |
| Set the per-block size in bytes; must satisfy ADR-0009 §2 at build time. | |
| PoolBuilder & | with_block_count (std::size_t block_count) noexcept |
| Set the block count; must satisfy ADR-0009 §3 at build time. | |
| PoolBuilder & | with_growth_factor (std::size_t growth_factor) noexcept |
| Opt into dynamic growth with the given geometric factor (ADR-0024 §3). | |
| std::optional< Pool > | build () const |
Produce a std::optional<Pool> from the accumulated configuration. | |
Fluent builder for configured Pool instances.
Accumulates configuration through chainable with_* setters and produces a std::optional<Pool> on build(). The Builder pattern absorbs the future configuration-explosion (thread-safety strategy from Milestone 4, dynamic-growth policy from Milestone 5) without requiring ABI changes to the Pool ctor or to Pool::make. Adopted in ADR-0011 §2.
Usage:
build() is const, so a configured builder can produce multiple identically-configured pools (useful for tests and for benchmark setup). A default-constructed builder has block_size_ == 0 and block_count_ == 0; calling build() on it returns std::nullopt — the deliberate fail-loud behaviour for forgotten configuration.
Definition at line 219 of file memory_pool.hpp.
|
noexcept |
Opt into dynamic growth with the given geometric factor (ADR-0024 §3).
A factor >= 2 makes build() produce a dynamic pool via Pool::make_dynamic; the default (0) leaves the pool fixed-size. Under a lock-free build, a dynamic build returns std::nullopt (ADR-0024 §2).