7 template <
class Key,
class T>
22 template <
class Allocator,
class Key,
class T>
59 _iter(
std::move(a_rhs._iter)),
60 _idx(
std::move(a_rhs._idx))
63 a_rhs._iter =
nullptr;
64 a_rhs._idx = a_rhs._proxy->_capacity;
73 _iter = _proxy->
_data[_idx];
74 while (!_iter && _idx < _proxy->
_capacity) {
76 _iter = _proxy->
_data[_idx];
94 assert(_proxy == a_rhs._proxy);
101 assert(_proxy == a_rhs._proxy);
103 _iter = std::move(a_rhs._iter);
106 _idx = std::move(a_rhs._idx);
107 a_rhs._idx = a_rhs._proxy->_capacity;
112 assert(_proxy == a_rhs._proxy);
113 std::swap(_iter, a_rhs._iter);
114 std::swap(_idx, a_rhs._idx);
133 assert(_proxy == a_rhs._proxy);
135 if (_idx != a_rhs._idx) {
140 return _iter == a_rhs._iter;
163 _iter = _proxy->
_data[_idx];
164 }
while (!_iter && _idx < _proxy->
_capacity);
205 _data = malloc<value_type*>(memSize);
206 std::memset(
_data, 0, memSize);
258 [[nodiscard]]
bool empty() const noexcept
270 for (std::uint32_t i = 0; i <
_capacity; i++) {
272 auto elem =
_data[i];
287 auto item =
_data[index];
291 if (
key_eq(a_key, item->key)) {
293 item->val = std::forward<M>(a_obj);
303 assign_value(item, std::move(a_key), std::forward<M>(a_obj));
304 item->next =
_data[index];
314 auto item =
_data[index];
318 if (
key_eq(a_key, item->key)) {
335 auto result = do_find(a_key);
336 return result ?
iterator(
this, result->first, result->second) :
end();
341 auto result = do_find(a_key);
353 std::optional<std::pair<value_type*, std::uint32_t>> do_find(
const Key& a_key)
const
356 for (
auto iter =
_data[idx]; iter; iter = iter->
next) {
357 if (
key_eq(a_key, iter->first)) {
358 return std::make_optional(std::make_pair(iter, idx));
Definition NiTMapBase.h:24
iterator_base< value_type > iterator
Definition NiTMapBase.h:184
std::uint32_t size_type
Definition NiTMapBase.h:33
std::uint32_t _capacity
Definition NiTMapBase.h:367
bool insert_or_assign(key_type &&a_key, M &&a_obj)
Definition NiTMapBase.h:283
const_iterator cend() const
Definition NiTMapBase.h:253
virtual value_type * malloc_value()=0
virtual std::uint32_t hash_function(key_type a_key) const
T mapped_type
Definition NiTMapBase.h:31
iterator_base< const value_type > const_iterator
Definition NiTMapBase.h:185
const_iterator find(const Key &a_key) const
Definition NiTMapBase.h:339
virtual ~NiTMapBase()
Definition NiTMapBase.h:209
Key key_type
Definition NiTMapBase.h:30
virtual void assign_value(value_type *a_value, key_type a_key, mapped_type a_mapped)
virtual void clear_value(value_type *a_value)
const_iterator cbegin() const
Definition NiTMapBase.h:238
std::uint32_t _pad0C
Definition NiTMapBase.h:368
size_type size() const noexcept
Definition NiTMapBase.h:263
NiTMapBase(size_type a_capacity=37)
Definition NiTMapBase.h:198
value_type ** _data
Definition NiTMapBase.h:369
size_type erase(const key_type &a_key)
Definition NiTMapBase.h:310
AntiBloatAllocator _allocator
Definition NiTMapBase.h:370
iterator begin()
Definition NiTMapBase.h:228
NiTMapItem< Key, T > value_type
Definition NiTMapBase.h:32
const_iterator begin() const
Definition NiTMapBase.h:233
virtual bool key_eq(key_type a_lhs, key_type a_rhs) const
bool empty() const noexcept
Definition NiTMapBase.h:258
iterator end()
Definition NiTMapBase.h:243
const_iterator end() const
Definition NiTMapBase.h:248
void clear()
Definition NiTMapBase.h:268
iterator find(const Key &a_key)
Definition NiTMapBase.h:333
virtual void free_value(value_type *a_value)=0
Definition NiTMapBase.h:9
Key key_type
Definition NiTMapBase.h:11
key_type first
Definition NiTMapBase.h:16
mapped_type second
Definition NiTMapBase.h:17
NiTMapItem * next
Definition NiTMapBase.h:15
T mapped_type
Definition NiTMapBase.h:12
Definition AbsorbEffect.h:6
void free(void *a_ptr)
Definition MemoryManager.h:187
Definition ActorValueList.h:28
Definition NiTMapBase.h:188
AntiBloatAllocator()
Definition NiTMapBase.h:189
size_type size
Definition NiTMapBase.h:195
Definition NiTMapBase.h:37
reference operator*() const
Definition NiTMapBase.h:117
iterator_base()
Definition NiTMapBase.h:45
iterator_base(iterator_base &&a_rhs)
Definition NiTMapBase.h:57
iterator_base & operator++()
Definition NiTMapBase.h:152
iterator_base(NiTMapBase *a_proxy, value_type *a_iter, std::uint32_t a_idx)
Definition NiTMapBase.h:80
iterator_base & operator=(iterator_base &&a_rhs)
Definition NiTMapBase.h:99
iterator_base(NiTMapBase *a_proxy, std::uint32_t a_idx)
Definition NiTMapBase.h:67
pointer operator->() const
Definition NiTMapBase.h:124
iterator_base(const iterator_base &a_rhs)
Definition NiTMapBase.h:51
bool operator!=(const iterator_base &a_rhs) const
Definition NiTMapBase.h:146
U value_type
Definition NiTMapBase.h:40
iterator_base & operator=(const iterator_base &a_rhs)
Definition NiTMapBase.h:92
std::ptrdiff_t difference_type
Definition NiTMapBase.h:39
~iterator_base()
Definition NiTMapBase.h:89
iterator_base operator++(int)
Definition NiTMapBase.h:171
void swap(iterator_base &a_rhs)
Definition NiTMapBase.h:110
U * pointer
Definition NiTMapBase.h:41
U & reference
Definition NiTMapBase.h:42
std::forward_iterator_tag iterator_category
Definition NiTMapBase.h:43
bool operator==(const iterator_base &a_rhs) const
Definition NiTMapBase.h:131