FastLED 3.10.8
Loading...
Searching...
No Matches

◆ update() [1/2]

template<typename Key, typename Value, typename Less = fl::less<Key>>
bool fl::flat_map< Key, Value, Less >::update ( const Key & key,
const Value & value )
inline

Definition at line 428 of file flat_map.h.

428 {
429 iterator it = find(key);
430 if (it != end()) {
431 it->second = value;
432 return true; // Updated
433 }
434 // Key doesn't exist, insert it
435 auto result = insert(value_type(key, value));
436 return result.second; // Return whether insertion succeeded
437 }
typename vector_type::iterator iterator
Definition flat_map.h:47
iterator find(const Key &key) FL_NO_EXCEPT
Definition flat_map.h:156
fl::pair< Key, Value > value_type
Definition flat_map.h:37
fl::pair< iterator, bool > insert(const value_type &value) FL_NO_EXCEPT
Definition flat_map.h:245
iterator end() FL_NO_EXCEPT
Definition flat_map.h:86