FastLED 3.10.8
Loading...
Searching...
No Matches

◆ insert() [1/6]

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
pair< iterator, bool > fl::unordered_map< Key, T, Hash, KeyEqual, INLINED_COUNT >::insert ( const Key & key,
const T & value )
inline

Definition at line 325 of file unordered_map.h.

325 {
326 const bool will_rehash = needs_rehash();
327 if (will_rehash) {
328 // if half the buckets are tombstones, rehash inline to prevent
329 // memory spill over into the heap.
330 if (_tombstones > _size) {
332 } else {
333 rehash_internal(_buckets.size() * 2);
334 }
335 }
337 bool is_new;
339 idx = p.first;
340 is_new = p.second;
341 if (is_new) {
342 _buckets[idx].key = key;
343 _buckets[idx].value = value;
345 ++_size;
346 } else {
347 FASTLED_ASSERT(idx != npos(), "unordered_map::insert: invalid index");
348 _buckets[idx].value = value;
349 }
350 return {iterator(this, idx), is_new};
351 }
void rehash_internal(fl::size new_cap) FL_NO_EXCEPT
bool needs_rehash() const FL_NO_EXCEPT
static fl::size npos() FL_NO_EXCEPT
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
void mark_occupied(fl::size idx) FL_NO_EXCEPT
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_NULL_DEREFERENCE void rehash_inline_no_resize() FL_NO_EXCEPT
pair< fl::size, bool > find_slot(const Key &key) const FL_NO_EXCEPT