FastLED
3.9.15
Loading...
Searching...
No Matches
◆
operator[]()
template<typename
Key
, typename Value, typename Less = fl::less<Key>>
Value &
fl::flat_map
<
Key
, Value, Less >::operator[]
(
const
Key
&
key
)
inline
Definition at line
103
of file
flat_map.h
.
103
{
104
auto
it
=
lower_bound
(
key
);
105
if
(
it
!=
end
() && !
mLess
(
key
,
it
->first) && !
mLess
(
it
->first,
key
)) {
106
return
it
->second;
107
}
108
// Key not found, insert it with default value
109
bool
success
=
mData
.insert(
it
,
value_type
(
key
,
Value
()));
110
FASTLED_ASSERT
(
success
,
"Insert failed in flat_map::operator[]"
);
111
// Find the newly inserted element
112
it
=
find
(
key
);
113
return
it
->second;
114
}
fl::flat_map::mLess
Less mLess
Definition
flat_map.h:52
fl::flat_map::value_type
fl::pair< Key, Value > value_type
Definition
flat_map.h:35
fl::flat_map::lower_bound
iterator lower_bound(const Key &key) FL_NOEXCEPT
Definition
flat_map.h:166
fl::flat_map::end
iterator end() FL_NOEXCEPT
Definition
flat_map.h:84
fl::flat_map::find
iterator find(const Key &key) FL_NOEXCEPT
Definition
flat_map.h:136
fl::flat_map::mData
vector_type mData
Definition
flat_map.h:51
fl::flat_map
Definition
flat_map.h:29
fl
flat_map
Generated on Tue Jun 16 2026 00:07:05 for FastLED by
1.13.2