BoundedHeap
Parameters
TType of elements stored in the heap
Public Methods
BoundedHeap
inline
Parameters
-
limitMaximum number of elements to retain -
distDistance function - lower values are preferred
Exceptions
std::invalid_argumentIf limit < 1
insert
inline
Parameters
entryElement to insert
peek
const
Returns
Pointer to root element (max distance), or nullptr if empty :::note The returned pointer is invalid after insert() or destruction :::to_sorted
const
Returns
Vector of elements sorted from best to worst :::note Returns copy of elements; original heap is unchanged :::size
const
Returns
Number of elements (0 to limit_)empty
const
Public Types
DistFn
Private Attributes
data_
limit_
dist_
Private Methods
sift_up
inline
sift_down
inline