FastLED
3.9.15
Loading...
Searching...
No Matches
◆
insert()
template<typename T, size_t INLINED_SIZE>
bool
fl::InlinedVector
< T, INLINED_SIZE >::insert
(
iterator
pos
,
const T &
value
)
inline
Definition at line
972
of file
vector.h
.
972
{
973
if
(
mUsingHeap
) {
974
// return insert(pos, value);
975
return
mHeap
.insert(
pos
,
value
);
976
}
977
978
if
(
mFixed
.size() <
INLINED_SIZE
) {
979
return
mFixed
.insert(
pos
,
value
);
980
}
981
982
// size_t diff = pos - mFixed.begin();
983
// make safe for data that grows down
984
size_t
idx
=
mFixed
.end() -
pos
;
985
986
// overflow: move inline data into heap
987
mHeap
.reserve(
INLINED_SIZE
* 2);
988
for
(
auto
&
v
:
mFixed
) {
989
mHeap
.push_back(
v
);
990
}
991
mFixed
.clear();
992
return
mHeap
.insert(
mHeap
.begin() +
idx
,
value
);
993
}
fl::InlinedVector::mHeap
HeapVector< T > mHeap
Definition
vector.h:1025
fl::InlinedVector::mFixed
FixedVector< T, INLINED_SIZE > mFixed
Definition
vector.h:1024
fl::InlinedVector::mUsingHeap
bool mUsingHeap
Definition
vector.h:1023
fl::InlinedVector
Definition
vector.h:761
References
mFixed
,
mHeap
,
mUsingHeap
, and
pos
.
fl
InlinedVector
Generated on Sat May 24 2025 22:44:25 for FastLED by
1.13.2