|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Space-efficient bit array implementation. More...
#include <bit>#include <cstdint>#include <iostream>#include <fstream>#include <algorithm>#include <type_traits>#include <aleph.H>#include <tpl_dynArray.H>#include <ah-errors.H>#include <ahDry.H>#include <ah-dry-mixin.H>Go to the source code of this file.
Classes | |
| class | Aleph::Byte |
| class | Aleph::BitArray |
| Contiguous array of bits. More... | |
| class | Aleph::BitArray::BitProxy |
| class | Aleph::BitArray::Iterator |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Space-efficient bit array implementation.
This file provides a compact bit array that stores boolean values using only 1 bit per element, achieving 8x memory savings compared to using bool arrays.
| Operation | Time | Space |
|---|---|---|
| read_bit | O(1) | O(1) |
| write_bit | O(1) | O(1) |
| resize | O(n) | O(n/8) |
| AND/OR/XOR | O(n) | O(1) |
| popcount | O(n) | O(1) |
Bits are packed into bytes, with bit 0 of element i stored in the lowest bit of byte i/8, position i%8.
Definition in file bitArray.H.