FastLED
3.10.8
Loading...
Searching...
No Matches
◆
reserve()
template<typename
Key
, typename T, typename
Hash
= Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
void
fl::unordered_map
<
Key
, T,
Hash
, KeyEqual, INLINED_COUNT >::reserve
(
fl::size
n
)
inline
Definition at line
787
of file
unordered_map.h
.
787
{
788
// Calculate required buckets to hold n elements without exceeding load factor
789
float
max_lf
=
max_load_factor
();
790
if
(
max_lf
<= 0.0f) {
791
max_lf
= 0.7f;
// Default if somehow zero
792
}
793
// Required buckets = ceil(n / max_load_factor)
794
fl::size
required_buckets
=
static_cast<
fl::size
>
(
795
static_cast<
float
>
(
n
) /
max_lf
+ 0.999999f
// Add almost 1 to simulate ceil
796
);
797
if
(
required_buckets
>
_buckets
.size()) {
798
rehash
(
required_buckets
);
799
}
800
}
fl::unordered_map::max_load_factor
float max_load_factor() const FL_NO_EXCEPT
Definition
unordered_map.h:756
fl::unordered_map::_buckets
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
Definition
unordered_map.h:1045
fl::unordered_map::rehash
void rehash(fl::size n) FL_NO_EXCEPT
Definition
unordered_map.h:772
fl::unordered_map
Definition
unordered_map.h:59
fl
unordered_map
Generated on Sun Oct 18 2026 00:57:09 for FastLED by
1.13.2