FastLED 3.9.15
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 442 of file flat_map.h.

442 {
443 iterator it = find(key);
444 if (it != end()) {
445 it->second = value;
446 return true; // Updated
447 }
448 // Key doesn't exist, insert it
449 auto result = insert(value_type(key, value));
450 return result.second; // Return whether insertion succeeded
451 }
typename vector_type::iterator iterator
Definition flat_map.h:45
fl::pair< Key, Value > value_type
Definition flat_map.h:35
iterator end() FL_NOEXCEPT
Definition flat_map.h:84
iterator find(const Key &key) FL_NOEXCEPT
Definition flat_map.h:136
fl::pair< iterator, bool > insert(const value_type &value) FL_NOEXCEPT
Definition flat_map.h:251