bitarray / bitvector / bitspan This repo provides an alternative to C++'s std::bitset with all the features of C++20's header. As with std::bitset, bitarray supports arbitrary length arrays of bits. It also supports dynamic bit lengths bitvector (on std::vector). It supports mmap'd bitsets bitspan (via std::span). It aims to be simpler, faster, and more featureful. Faster, because: most operations are in-place, to…
This repo provides an alternative to C++'s std::bitset with all the features of C++20’s <bit> header.
As with std::bitset, bitarray supports arbitrary length arrays of bits. It also supports dynamic bit lengths bitvector (on std::vector). It supports mmap’d bitsets bitspan (via std::span).
It aims to be simpler, faster, and more featureful.
Faster, because:
most operations are in-place, to eliminate large copies
the word size can be larger to reduce the number of iterations. potentially doing half as many iterations, std::bitset uses long
or the word size can be smaller to reduce wasted space (relevant for many small bitsets)
The added features are (or will be):
Easy casts between bitarray, bitvector, bitspan
Easy constructors from std::array, std::vector, std::span, std::initializer_list
Directly access all the underlying words
bitset only allows you to get the lowest unsigned long long’s worth of bits
or output to a string of '1’s and '0’s…
Easily change the underlying word type for whatever performance/storage needs (8/16/32/64/128 bit types are all supported and tested)
评论