|
JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
|
Flat allocator for bool — disables bit-packing in jh::runtime_arr<bool>.
More...
#include <jh/core/runtime_arr.h>
Classes | |
| struct | rebind |
Public Types | |
| using | value_type = bool |
Public Member Functions | |
| bool * | allocate (std::size_t n) |
| void | deallocate (bool *p, std::size_t) noexcept |
| bool | operator== (const bool_flat_alloc &) const noexcept=default |
Flat allocator for bool — disables bit-packing in jh::runtime_arr<bool>.
bool_flat_alloc provides a minimal, stateless allocator used to instantiate jh::runtime_arr<bool, bool_flat_alloc> as a byte-based (non-packed) boolean array.
Normally, jh::runtime_arr<bool> uses a bit-packed storage model, compressing 8 boolean values into a single byte (64 per 64-bit word). By supplying this allocator, each bool instead occupies 1 full byte, allowing direct memory access and STL-contiguous semantics.
Behavior
static. bool[n] arrays via new[]. delete[]. std::allocator_traits and is not STL-compatible. Used for performance benchmarking and correctness testing of the jh::runtime_arr<bool> specialization, or for scenarios where bit-packing overhead is undesirable (e.g. frequent random access or interop with APIs expecting bool* pointers).
jh::runtime_arr<bool> — bit-packed specialization. jh::runtime_arr<bool, runtime_arr_helper::bool_flat_alloc> — byte-based variant.