FastLED 3.10.8
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 283 of file flat_map.h.

283 {
284 auto it = lower_bound(key);
285 if (it != end() && !mLess(key, it->first) && !mLess(it->first, key)) {
286 if (result) *result = exists;
287 return false;
288 }
289 bool success = mData.insert(it, value_type(key, value));
290 if (success) {
291 if (result) *result = inserted;
292 return true;
293 }
294 if (result) *result = at_capacity;
295 return false;
296 }
fl::pair< Key, Value > value_type
Definition flat_map.h:37
iterator lower_bound(const Key &key) FL_NO_EXCEPT
Definition flat_map.h:208
iterator end() FL_NO_EXCEPT
Definition flat_map.h:86
vector_type mData
Definition flat_map.h:53