10#include "../defines.h"
11#include "./iteratorUtils.h"
16 template <
int N,
typename T =
int>
22 PONCA_MULTIARCH_STD_MATH(
abs);
23 return (
abs(
_x) * 2654435761u) %
N;
54 template <
int N,
typename T =
int,
template <
int,
typename>
typename _HashFunctor = HashDefaultFunctor,
58 static_assert(
N > 0,
"The capacity must be strictly positive");
60 using container_type = std::array<T, N>;
61 using iterator =
typename container_type::iterator;
62 using const_iterator =
typename container_type::const_iterator;
86 constexpr PONCA_MULTIARCH
HashSet() : m_data() {}
92 PONCA_MULTIARCH
void clear();
109 PONCA_MULTIARCH std::pair<typename Self::iterator, bool>
insert(
const T&
_value);
120 PONCA_MULTIARCH [[
nodiscard]]
inline Self::const_iterator
cbegin()
const;
123 PONCA_MULTIARCH [[
nodiscard]]
inline Self::const_iterator
cend()
const;
129 PONCA_MULTIARCH [[
nodiscard]]
inline Self::iterator
end();
132 container_type m_data{};
136#include "./hashset.hpp"
Aggregator class used to declare specialized structures using CRTP.
Stores unique signed integer values in a contiguous array.
Self::iterator end()
The end of the internal array.
std::pair< typename Self::iterator, bool > insert(const T &_value)
Tries to insert a value in the HashSet.
bool contains(T _value) const
Tries to find a value in the HashSet.
Self::const_iterator cend() const
The end of the internal array.
Self::iterator begin()
The beginning of the internal array.
Self::const_iterator cbegin() const
The beginning of the internal array.
void clear()
Empty the array.
bool search(T _value, T &_searchedIdx) const
Search for a value in the HashSet.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
static constexpr T hash(const int _x)
The default hashing function : (abs(x) * 2654435761u) % N.