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

◆ insert() [1/6]

template<typename Key, typename Value, typename Less = fl::less<Key>>
bool fl::flat_map< Key, Value, Less >::insert ( const Key & key,
const Value & value,
insert_result * result = nullptr )
inline

Definition at line 289 of file flat_map.h.

289 {
290 auto it = lower_bound(key);
291 if (it != end() && !mLess(key, it->first) && !mLess(it->first, key)) {
292 if (result) *result = exists;
293 return false;
294 }
295 bool success = mData.insert(it, value_type(key, value));
296 if (success) {
297 if (result) *result = inserted;
298 return true;
299 }
300 if (result) *result = at_capacity;
301 return false;
302 }
fl::pair< Key, Value > value_type
Definition flat_map.h:35
iterator lower_bound(const Key &key) FL_NOEXCEPT
Definition flat_map.h:166
iterator end() FL_NOEXCEPT
Definition flat_map.h:84
vector_type mData
Definition flat_map.h:51