FastLED 3.9.15
Loading...
Searching...
No Matches

◆ insert() [4/4]

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

Definition at line 218 of file flat_set.h.

218 {
219 auto key = value;
220 auto it = lower_bound(key);
221 if (it != end() && !mLess(key, *it) && !mLess(*it, key)) {
222 return fl::pair<iterator, bool>(it, false); // Already exists
223 }
224 bool success = mData.insert(it, fl::move(value));
225 if (success) {
226 // After insert, find the newly inserted element
227 it = find(key);
228 return fl::pair<iterator, bool>(it, true);
229 }
230 return fl::pair<iterator, bool>(end(), false);
231 }
vector_type mData
Definition flat_set.h:44
iterator end()
Definition flat_set.h:76
iterator find(const Key &key)
Definition flat_set.h:94
iterator lower_bound(const Key &key)
Definition flat_set.h:119

References end(), find(), lower_bound(), mData, mLess, fl::fl::move(), and fl::type_rank< T >::value.

+ Here is the call graph for this function: