FastLED 3.9.15
Loading...
Searching...
No Matches

◆ operator[]()

template<typename Key, typename Value, typename Less = fl::DefaultLess<Key>>
Value & fl::SortedHeapMap< Key, Value, Less >::operator[] ( const Key & key)
inline

Definition at line 395 of file map.h.

395 {
396 iterator it = find(key);
397 if (it != end()) {
398 return it->second;
399 }
400 Pair pair(key, Value());
401 bool ok = data.insert(pair);
402 FASTLED_ASSERT(ok, "Failed to insert into SortedHeapMap");
403 return data.find(pair)->second; // TODO: optimize.
404 }
#define FASTLED_ASSERT(x, MSG)
Definition assert.h:9
iterator end()
Definition map.h:347
SortedHeapVector< Pair, PairLess >::iterator iterator
Definition map.h:278
iterator find(const Key &key)
Definition map.h:351
SortedHeapVector< Pair, PairLess > data
Definition map.h:274