FastLED 3.9.15
Loading...
Searching...
No Matches
fl::HashMap< Key, T, Hash, KeyEqual, INLINED_COUNT > Class Template Reference

Detailed Description

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
class fl::HashMap< Key, T, Hash, KeyEqual, INLINED_COUNT >

Definition at line 49 of file hash_map.h.

#include <hash_map.h>

+ Inheritance diagram for fl::HashMap< Key, T, Hash, KeyEqual, INLINED_COUNT >:
+ Collaboration diagram for fl::HashMap< Key, T, Hash, KeyEqual, INLINED_COUNT >:

Classes

struct  const_iterator
 
struct  Entry
 
struct  iterator
 

Public Member Functions

 HashMap (size_t initial_capacity=FASTLED_HASHMAP_INLINED_COUNT, float max_load=0.7f)
 
iterator begin ()
 
const_iterator begin () const
 
size_t capacity () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool erase (const Key &key)
 
iterator find (const Key &key)
 
const_iterator find (const Key &key) const
 
T * find_value (const Key &key)
 
const T * find_value (const Key &key) const
 
void insert (const Key &key, const T &value)
 
bool needs_rehash () const
 
T & operator[] (const Key &key)
 
bool remove (const Key &key)
 
void setLoadFactor (float f)
 
size_t size () const
 

Static Public Member Functions

static bool NeedsRehash (size_t size, size_t bucket_size, size_t tombstones, uint8_t load_factor)
 

Private Types

enum  { kLinearProbingOnlySize = 8 , kQuadraticProbingTries = 8 }
 

Private Member Functions

size_t find_index (const Key &key) const
 
pair< size_t, bool > find_slot (const Key &key) const
 
size_t find_unoccupied_index_using_bitset (const Key &key, const fl::bitset< 1024 > &occupied_set) const
 
bool is_deleted (size_t idx) const
 
bool is_empty (size_t idx) const
 
bool is_occupied (size_t idx) const
 
void mark_deleted (size_t idx)
 
void mark_empty (size_t idx)
 
void mark_occupied (size_t idx)
 
void rehash (size_t new_cap)
 
void rehash_inline_no_resize ()
 

Static Private Member Functions

static size_t next_power_of_two (size_t n)
 

Private Attributes

fl::vector_inlined< Entry, INLINED_COUNT > _buckets
 
fl::bitset< 1024 > _deleted
 
KeyEqual _equal
 
Hash _hash
 
fl::bitset< 1024 > _occupied
 
size_t _size
 
size_t _tombstones
 
uint8_t mLoadFactor
 

Static Private Attributes

static constexpr size_t npos = size_t(-1)
 

The documentation for this class was generated from the following file: