FastLED
3.10.8
Loading...
Searching...
No Matches
◆
insert_or_assign()
[1/2]
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_or_assign
(
const
Key
&
key
,
T &&
value
)
inline
Definition at line
414
of file
unordered_map.h
.
414
{
415
const
bool
will_rehash
=
needs_rehash
();
416
if
(
will_rehash
) {
417
if
(
_tombstones
>
_size
) {
418
rehash_inline_no_resize
();
419
}
else
{
420
rehash_internal
(
_buckets
.size() * 2);
421
}
422
}
423
fl::size
idx
;
424
bool
is_new
;
425
fl::pair<fl::size, bool>
p
=
find_slot
(
key
);
426
idx
=
p
.first;
427
is_new
=
p
.second;
428
if
(
is_new
) {
429
_buckets
[
idx
].key =
key
;
430
_buckets
[
idx
].value =
fl::move
(
value
);
431
mark_occupied
(
idx
);
432
++
_size
;
433
}
else
{
434
FASTLED_ASSERT
(
idx
!=
npos
(),
"unordered_map::insert_or_assign: invalid index"
);
435
_buckets
[
idx
].value =
fl::move
(
value
);
436
}
437
return
{
iterator
(
this
,
idx
),
is_new
};
438
}
fl::unordered_map::rehash_internal
void rehash_internal(fl::size new_cap) FL_NO_EXCEPT
Definition
unordered_map.h:914
fl::unordered_map::needs_rehash
bool needs_rehash() const FL_NO_EXCEPT
Definition
unordered_map.h:319
fl::unordered_map::npos
static fl::size npos() FL_NO_EXCEPT
Definition
unordered_map.h:803
fl::unordered_map::_buckets
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
Definition
unordered_map.h:1045
fl::unordered_map::_size
fl::size _size
Definition
unordered_map.h:1046
fl::unordered_map::mark_occupied
void mark_occupied(fl::size idx) FL_NO_EXCEPT
Definition
unordered_map.h:816
fl::unordered_map::rehash_inline_no_resize
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_NULL_DEREFERENCE void rehash_inline_no_resize() FL_NO_EXCEPT
Definition
unordered_map.h:939
fl::unordered_map::find_slot
pair< fl::size, bool > find_slot(const Key &key) const FL_NO_EXCEPT
Definition
unordered_map.h:848
fl::unordered_map::_tombstones
fl::size _tombstones
Definition
unordered_map.h:1047
fl::unordered_map
Definition
unordered_map.h:59
fl::adl_barrier::move
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition
move.h:30
fl::unordered_map::iterator
Definition
unordered_map.h:188
fl
unordered_map
Generated on Sun Oct 18 2026 00:57:09 for FastLED by
1.13.2