Class BoolSet

Nested Relationships

Nested Types

Class Documentation

class BoolSet

a set of integers in [ 0 , N ) as a boolean vector

Public Types

using Item = long

the type of the items

using value_type = long
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = long
using const_reference = long
using const_iterator = SlotIterator<BoolSet, Places>
using iterator = const_iterator

Public Functions

explicit BoolSet(long N)

Set( N ): the empty set of the integers in [ 0 , N )

Pre:

N >= 0

std::size_t size(void) const
bool empty(void) const
long dim(void) const

the size N of the vector

bool contains(long x) const

false also for an x out of [ 0 , N )

void insert(long x)
Pre:

x in [ 0 , N )

Post:

x is in the set

void remove(long x)
Post:

x is not in the set

std::optional<long> min(void) const

the smallest item, O( N ) time

std::optional<long> max(void) const

the largest item, O( N ) time

template<class F>
void forEach(F &&f) const

f( x ) on the items in increasing order, O( N ) time

inline const_iterator begin(void) const
inline const_iterator end(void) const
inline const_iterator cbegin(void) const
inline const_iterator cend(void) const
struct Places

the places of the table, for SlotIterator

Public Static Functions

static inline std::size_t size(const auto &o)
static inline bool occupied(const auto &o, std::size_t i)
static inline auto read(const auto&, std::size_t i)