FastLED 3.9.15
Loading...
Searching...
No Matches

◆ try_emplace() [1/2]

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
template<typename... Args>
pair< iterator, bool > fl::unordered_map< Key, T, Hash, KeyEqual, INLINED_COUNT >::try_emplace ( const Key & k,
Args &&... args )
inline

Definition at line 489 of file unordered_map.h.

489 {
490 const bool will_rehash = needs_rehash();
491 if (will_rehash) {
492 if (_tombstones > _size) {
494 } else {
495 rehash_internal(_buckets.size() * 2);
496 }
497 }
499 bool is_new;
501 idx = p.first;
502 is_new = p.second;
503 if (is_new) {
504 // Key doesn't exist, construct in place
505 _buckets[idx].key = k;
506 _buckets[idx].value = T(fl::forward<Args>(args)...);
508 ++_size;
509 }
510 // If not new, key already exists - don't construct value, just return existing iterator
511 return {iterator(this, idx), is_new};
512 }
void mark_occupied(fl::size idx)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_NULL_DEREFERENCE void rehash_inline_no_resize()
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
pair< fl::size, bool > find_slot(const Key &key) const
bool needs_rehash() const
void rehash_internal(fl::size new_cap)