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

◆ insert() [2/6]

template<typename Key, typename Value, typename Less = fl::less<Key>>
fl::pair< iterator, bool > fl::flat_map< Key, Value, Less >::insert ( const value_type & value)
inline

Definition at line 245 of file flat_map.h.

245 {
246 auto it = lower_bound(value.first);
247 if (it != end() && !mLess(value.first, it->first) && !mLess(it->first, value.first)) {
248 return fl::pair<iterator, bool>(it, false); // Already exists
249 }
250 bool success = mData.insert(it, value);
251 if (success) {
252 // After insert, find the newly inserted element
253 it = find(value.first);
254 return fl::pair<iterator, bool>(it, true);
255 }
256 return fl::pair<iterator, bool>(end(), false);
257 }
iterator find(const Key &key) FL_NO_EXCEPT
Definition flat_map.h:156
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

Referenced by fl::flat_map< int, FxPtr >::emplace(), fl::flat_map< int, FxPtr >::emplace_hint(), fl::flat_map< int, FxPtr >::insert(), fl::flat_map< int, FxPtr >::insert(), fl::flat_map< int, FxPtr >::insert_or_update(), fl::flat_map< int, FxPtr >::update(), and fl::flat_map< int, FxPtr >::update().

+ Here is the caller graph for this function: