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

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