FastLED
3.9.15
Loading...
Searching...
No Matches
◆
insert()
template<typename T, typename LessThan>
bool
fl::SortedHeapVector
< T, LessThan >::insert
(
const T &
value
,
InsertResult
*
result
=
nullptr
)
inline
Definition at line
543
of file
vector.h
.
543
{
544
// Find insertion point using binary search
545
iterator
pos
=
lower_bound
(
value
);
546
if
(
pos
!=
end
() && !
mLess
(
value
, *
pos
) && !
mLess
(*
pos
,
value
)) {
547
// return false; // Already inserted.
548
if
(
result
) {
549
// *result = kExists;
550
*
result
=
InsertResult::kExists
;
551
}
552
553
return
false
;
554
}
555
if
(
mArray
.size() >=
mMaxSize
) {
556
// return false; // Too full
557
if
(
result
) {
558
*
result
=
InsertResult::kMaxSize
;
559
}
560
return
false
;
561
}
562
mArray
.insert(
pos
,
value
);
563
if
(
result
) {
564
*
result
=
kInserted
;
565
}
566
567
return
true
;
568
}
fl::SortedHeapVector::mMaxSize
size_t mMaxSize
Definition
vector.h:513
fl::SortedHeapVector::lower_bound
iterator lower_bound(const T &value)
Definition
vector.h:571
fl::SortedHeapVector::mArray
HeapVector< T > mArray
Definition
vector.h:511
fl::SortedHeapVector::end
iterator end()
Definition
vector.h:650
fl::SortedHeapVector::mLess
LessThan mLess
Definition
vector.h:512
fl::SortedHeapVector::iterator
HeapVector< T >::iterator iterator
Definition
vector.h:516
fl::SortedHeapVector
Definition
vector.h:509
fl
SortedHeapVector
Generated on Fri Apr 18 2025 03:39:32 for FastLED by
1.13.2