bitdeque

Class that mimics std::deque<bool>, but with std::vector<bool>'s bit packing.

Synopsis

Declared in <util/bitdeque.h>

template<int BITS_PER_WORD = 4096 * 8>
class bitdeque;

Description

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.

Type Aliases

NameDescription
const_iterator Read-only random-access iterator over the bits.
const_pointer Const pointer type, void because individual bits are not addressable.
const_reference Read-only reference to a single bit (a plain bool by value).
const_reverse_iterator Read-only reverse iterator over the bits.
difference_type Signed integer type used for distances between iterators.
iterator Mutable random-access iterator over the bits.
pointer Pointer type, void because individual bits are not addressable.
reference Proxy reference to a single bit, returned by mutable element access.
reverse_iterator Mutable reverse iterator over the bits.
size_type Unsigned integer type used for sizes and bit indices.
value_type Type of the elements stored in the container.

Member Functions

NameDescription
bitdeque [constructor]Constructors
operator= Assignment operators
assign assign overloads
at Access an element with bounds checking, throwing std::out_of_range if out of bounds.
back Access the last element.
begin begin overloads
cbegin Return a read-only iterator to the first bit.
cend Return a read-only iterator past the last bit.
clear Empty the container.
crbegin Return a read-only reverse iterator to the last bit.
crend Return a read-only reverse iterator before the first bit.
emplace Insert a single bit before the given position.
emplace_back Append an element to the end of the container and return a reference to it.
emplace_front Prepend an element to the front of the container and return a reference to it.
empty Determine whether the container is empty.
end end overloads
erase erase overloads
front Access the first element.
insert insert overloads
max_size Return the maximum size of the container.
operator[] Access an element without bounds checking.
pop_back Remove the last element from the container.
pop_front Remove the first element from the container.
push_back Append an element to the end of the container.
push_front Prepend an element to the front of the container.
rbegin rbegin overloads
rend rend overloads
resize Resize the container.
shrink_to_fit Release unused memory.
size Count the number of bits in the container.
swap Exchange the contents of this container with another.

Friends

NameDescription
swapExchange the contents of two containers.
bitdeque::Iterator