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

251 {
252 auto it = lower_bound(value.first);
253 if (it != end() && !mLess(value.first, it->first) && !mLess(it->first, value.first)) {
254 return fl::pair<iterator, bool>(it, false); // Already exists
255 }
256 bool success = mData.insert(it, value);
257 if (success) {
258 // After insert, find the newly inserted element
259 it = find(value.first);
260 return fl::pair<iterator, bool>(it, true);
261 }
262 return fl::pair<iterator, bool>(end(), false);
263 }
iterator lower_bound(const Key &key) FL_NOEXCEPT
Definition flat_map.h:166
iterator end() FL_NOEXCEPT
Definition flat_map.h:84
iterator find(const Key &key) FL_NOEXCEPT
Definition flat_map.h:136
vector_type mData
Definition flat_map.h:51

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: