|
|
|
@ -14,18 +14,17 @@
|
|
|
|
|
|
|
|
|
|
/** Class that mimics std::deque<bool>, but with std::vector<bool>'s bit packing.
|
|
|
|
|
*
|
|
|
|
|
* BlobSize selects the (minimum) number of bits that are allocated at once.
|
|
|
|
|
* BITS_PER_WORD selects the (minimum) number of bits that are allocated at once.
|
|
|
|
|
* Larger values reduce the asymptotic memory usage overhead, at the cost of
|
|
|
|
|
* needing larger up-front allocations. The default is 4096 bytes.
|
|
|
|
|
*/
|
|
|
|
|
template<int BlobSize = 4096 * 8>
|
|
|
|
|
template<int BITS_PER_WORD = 4096 * 8>
|
|
|
|
|
class bitdeque
|
|
|
|
|
{
|
|
|
|
|
// Internal definitions
|
|
|
|
|
using word_type = std::bitset<BlobSize>;
|
|
|
|
|
using word_type = std::bitset<BITS_PER_WORD>;
|
|
|
|
|
using deque_type = std::deque<word_type>;
|
|
|
|
|
static_assert(BlobSize > 0);
|
|
|
|
|
static constexpr int BITS_PER_WORD = BlobSize;
|
|
|
|
|
static_assert(BITS_PER_WORD > 0);
|
|
|
|
|
|
|
|
|
|
// Forward and friend declarations of iterator types.
|
|
|
|
|
template<bool Const> class Iterator;
|
|
|
|
|