Indexed bitset

template<typename Indexer>
class indexed_bitset

Container that encapsulate a bitset, whose individual bits are accessible using a custom indexing mechanism instead of a zero-based integer indexing. It is an aggregate type and is a replacement for `std::bitset, although the set of operation provided is slightly different. The guarantees are the same as std::bitset for operations that exists in both.

Construction and destruction

Constructors

indexed_bitset() = default

Default construction

Copy and move constructors

indexed_bitset(unsigned long long)

Initialization from a ulonglong

indexed_bitset(checked_arg&&…)

Safe initialization

indexed_bitset(std::bitset const&)

Construction by copy of a bitset

Operators

Copy / move assignment

Destructor is explicitly defaulted.

Member functions

Data Access

Functions always present

indexed_bitset::test(indexd) const

Element access (range-checked)

indexed_bitset::operator[](index) const

Element access (unchecked)

indexed_bitset::all() const

Checks if all/any/none are set to true

indexed_bitset::any() const

indexed_bitset::none() const

indexed_bitset::count() const

Number of bits set to true

Observers

Capacity

indexed_bitset::size() const

Number of elements in the bitset

Extensions

in_range

Checks if an index is in the acceptable range