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

◆ try_emplace() [1/4]

template<typename Key, typename Value, typename Compare = less<Key>, typename Allocator = allocator_slab<char>>
template<typename... Args>
fl::pair< iterator, bool > fl::MapRedBlackTree< Key, Value, Compare, Allocator >::try_emplace ( const Key & key,
Args &&... args )
inline

Definition at line 1251 of file rbtree.h.

1251 {
1252 // Use lower_bound to find position (constructs Value() once for search)
1253 auto it = mTree.lower_bound(value_type(key, Value()));
1254
1255 // Check if key already exists
1256 if (it != mTree.end() && it->first == key) {
1257 // Key exists, do NOT construct value from args
1258 return fl::pair<iterator, bool>(it, false);
1259 }
1260
1261 // Key doesn't exist, now construct value from args and insert
1262 return mTree.emplace(key, fl::forward<Args>(args)...);
1263 }
fl::pair< Key, Value > value_type
Definition rbtree.h:1002

Referenced by fl::MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > >< Key, T, Compare >::try_emplace(), and fl::MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > >< Key, T, Compare >::try_emplace().

+ Here is the caller graph for this function: