FastLED
3.9.15
Loading...
Searching...
No Matches
◆
insert()
template<typename T, typename LessThan = fl::less<T>>
bool
fl::SortedHeapVector
< T, LessThan >::insert
(
const T &
value
,
InsertResult
*
result
=
nullptr
)
inline
Definition at line
777
of file
vector.h
.
777
{
778
// Find insertion point using binary search
779
iterator
pos
=
lower_bound
(
value
);
780
if
(
pos
!=
end
() && !
mLess
(
value
, *
pos
) && !
mLess
(*
pos
,
value
)) {
781
// return false; // Already inserted.
782
if
(
result
) {
783
// *result = kExists;
784
*
result
=
InsertResult::kExists
;
785
}
786
787
return
false
;
788
}
789
if
(
mArray
.size() >=
mMaxSize
) {
790
// return false; // Too full
791
if
(
result
) {
792
*
result
=
InsertResult::kMaxSize
;
793
}
794
return
false
;
795
}
796
mArray
.insert(
pos
,
value
);
797
if
(
result
) {
798
*
result
=
kInserted
;
799
}
800
801
return
true
;
802
}
fl::SortedHeapVector::lower_bound
iterator lower_bound(const T &value)
Definition
vector.h:806
fl::SortedHeapVector::mArray
HeapVector< T > mArray
Definition
vector.h:749
fl::SortedHeapVector::end
iterator end()
Definition
vector.h:879
fl::SortedHeapVector::mLess
LessThan mLess
Definition
vector.h:750
fl::SortedHeapVector::mMaxSize
fl::size mMaxSize
Definition
vector.h:751
fl::SortedHeapVector::iterator
HeapVector< T >::iterator iterator
Definition
vector.h:754
fl::SortedHeapVector
Definition
vector.h:747
fl
SortedHeapVector
Generated on Fri Aug 22 2025 20:59:37 for FastLED by
1.13.2