10#include "../defines.h"
12#include "./iteratorUtils.h"
17 template <
int N,
typename T =
int>
21 PONCA_MULTIARCH [[nodiscard]]
static constexpr T
hash(
const int _x)
23 PONCA_MULTIARCH_STD_MATH(abs);
24 return (abs(_x) * 2654435761u) % N;
55 template <
int N,
typename T =
int,
template <
int,
typename>
typename _HashFunctor = HashDefaultFunctor,
57 requires ValidCapacity<N>
60 using HashFunctor = _HashFunctor<N, T>;
61 using container_type = std::array<T, N>;
62 using iterator =
typename container_type::iterator;
63 using const_iterator =
typename container_type::const_iterator;
84 PONCA_MULTIARCH [[nodiscard]]
inline bool search(T _value, T& _searchedIdx)
const;
87 constexpr PONCA_MULTIARCH
HashSet() : m_data() {}
93 PONCA_MULTIARCH
void clear();
110 PONCA_MULTIARCH std::pair<typename Self::iterator, bool>
insert(
const T& _value);
117 PONCA_MULTIARCH [[nodiscard]]
bool contains(T _value)
const;
121 PONCA_MULTIARCH [[nodiscard]]
inline Self::const_iterator
cbegin()
const;
124 PONCA_MULTIARCH [[nodiscard]]
inline Self::const_iterator
cend()
const;
127 PONCA_MULTIARCH [[nodiscard]]
inline Self::iterator
begin();
130 PONCA_MULTIARCH [[nodiscard]]
inline Self::iterator
end();
133 container_type m_data{};
137#include "./hashset.hpp"
Stores unique signed integer values in a contiguous 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.
void clear()
Empty the array.
Self::const_iterator cend() const
The end of the internal array.
bool search(T _value, T &_searchedIdx) const
Search for a value in the HashSet.
Self::iterator end()
The end of the internal array.
Self::const_iterator cbegin() const
The beginning of the internal array.
Self::iterator begin()
The beginning of the internal array.
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.