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 361 of file map.h.

361 {
362 iterator it = find(key);
363 if (it != end()) {
364 return it->second;
365 }
366 Pair pair(key, Value());
367 bool ok = data.insert(pair);
368 FASTLED_ASSERT(ok, "Failed to insert into SortedHeapMap");
369 return data.find(pair)->second; // TODO: optimize.
370 }
iterator end()
Definition map.h:324
SortedHeapVector< Pair, PairLess >::iterator iterator
Definition map.h:254
iterator find(const Key &key)
Definition map.h:328
SortedHeapVector< Pair, PairLess > data
Definition map.h:251
Pair< Key, Value > pair
Definition pair.h:13