A fixed size heap backed by an array. The container inherits the properties of a fixed size array of type T
. The container keeps all N
elements alive until its lifetime ends, even if elements are popped/removed from the stack. It is guaranteed that no dynamic memory allocation takes place.
More...
template<typename T, std::size_t N, typename IsLess = std::less<T>>
class ph::TArrayHeap< T, N, IsLess >
A fixed size heap backed by an array. The container inherits the properties of a fixed size array of type T
. The container keeps all N
elements alive until its lifetime ends, even if elements are popped/removed from the stack. It is guaranteed that no dynamic memory allocation takes place.
- Template Parameters
-
T | Type of the array element. |
N | Maximum size of the backing array. |
IsLess | Comparator for the array element. The default comparator makes this heap a max heap. |
template<typename T , std::size_t N, typename IsLess >
Access the top item of the heap. By default, the top item is the maximum item (max heap). If the comparator is reversed, e.g., comparing using operator >
, then the top item is the minimum item (min heap).