FastLED 3.10.9
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 789 of file unordered_map.h.

789 {
790 // Calculate required buckets to hold n elements without exceeding load factor
791 float max_lf = max_load_factor();
792 if (max_lf <= 0.0f) {
793 max_lf = 0.7f; // Default if somehow zero
794 }
795 // Required buckets = ceil(n / max_load_factor)
796 fl::size required_buckets = static_cast<fl::size>(
797 static_cast<float>(n) / max_lf + 0.999999f // Add almost 1 to simulate ceil
798 );
799 if (required_buckets > _buckets.size()) {
801 }
802 }
float max_load_factor() const FL_NO_EXCEPT
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
void rehash(fl::size n) FL_NO_EXCEPT