10#include "../defines.h"
12#include "./iteratorUtils.h"
13#include "../../Common/Assert.h"
40 template <
int N,
typename T =
unsigned long long>
43 static_assert(
N > 0,
"The capacity must be strictly positive");
46 PONCA_MULTIARCH
BitSet() =
default;
51 PONCA_MULTIARCH
void flip(
int i);
78 PONCA_MULTIARCH
void clear();
81 static constexpr size_t BIT_SIZE =
sizeof(T) * 8;
82 static constexpr size_t ARRAY_SIZE = (
N + BIT_SIZE - 1) / BIT_SIZE;
Aggregator class used to declare specialized structures using CRTP.
A simple BitSet implementation that mimics a set of indices.
T m_data[ARRAY_SIZE]
An array of bytes.
bool insert(int value)
Tries to insert a value in the set.
void clear()
Sets all the bits to EMPTY.
void flip(int i)
Toggles the value of a bit.
bool erase(int value)
Tries to insert a value in the set.
static constexpr size_t ARRAY_SIZE
The number of bits in one element of the array.
bool contains(int value) const
Search if the value was already inserted or not.
This Source Code Form is subject to the terms of the Mozilla Public License, v.