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

◆ insert() [5/6]

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

Definition at line 298 of file flat_map.h.

298 {
299 auto key_copy = key;
300 auto it = lower_bound(key_copy);
301 if (it != end() && !mLess(key_copy, it->first) && !mLess(it->first, key_copy)) {
302 if (result) *result = exists;
303 return false;
304 }
305 bool success = mData.insert(it, value_type(fl::move(key), fl::move(value)));
306 if (success) {
307 if (result) *result = inserted;
308 return true;
309 }
310 if (result) *result = at_capacity;
311 return false;
312 }
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