FastLED 3.9.15
Loading...
Searching...
No Matches
hash_set.h
Go to the documentation of this file.
1
2#pragma once
3
4#include "fl/hash_map.h"
5
6namespace fl {
7
8// just define a hashset to be a hashmap with a dummy value
9
10template <typename Key, typename Hash = Hash<Key>,
11 typename KeyEqual = EqualTo<Key>>
12class HashSet : public HashMap<Key, bool, Hash, KeyEqual> {
13 public:
15 using iterator = typename Base::iterator;
16 using const_iterator = typename Base::const_iterator;
17
18 HashSet(size_t initial_capacity = 8, float max_load = 0.7f)
19 : Base(initial_capacity, max_load) {}
20
21 void insert(const Key &key) { Base::insert(key, true); }
22
23 void erase(const Key &key) { Base::erase(key); }
24
25 iterator find(const Key &key) { return Base::find(key); }
26};
27
28template <typename Key, typename Hash = Hash<Key>,
29 typename KeyEqual = EqualTo<Key>>
31
32} // namespace fl
HashMap(size_t initial_capacity=FASTLED_HASHMAP_INLINED_COUNT, float max_load=0.7f)
Definition hash_map.h:51
void insert(const Key &key, const bool &value)
Definition hash_map.h:200
iterator find(const Key &key)
Definition hash_map.h:259
void insert(const Key &key)
Definition hash_set.h:21
HashMap< Key, bool, Hash, KeyEqual > Base
Definition hash_set.h:14
typename Base::const_iterator const_iterator
Definition hash_set.h:16
HashSet(size_t initial_capacity=8, float max_load=0.7f)
Definition hash_set.h:18
iterator find(const Key &key)
Definition hash_set.h:25
typename Base::iterator iterator
Definition hash_set.h:15
void erase(const Key &key)
Definition hash_set.h:23
HashSet< Key, Hash, KeyEqual > hash_set
Definition hash_set.h:30
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Definition Keyboard.h:22