Remove every entry but keep the allocated storage for reuse.
The insertion counter is reset as well, so a cleared heap behaves exactly like a freshly initialised one with the same capacity and the same min/max ordering.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(heap_t), | intent(inout) | :: | self |
subroutine heap_clear(self) !! Remove every entry but keep the allocated storage for reuse. !! !! The insertion counter is reset as well, so a cleared heap behaves !! exactly like a freshly initialised one with the same capacity and the !! same min/max ordering. class(heap_t), intent(inout) :: self self%n_entries = 0 self%n_pushed = 0_int64 end subroutine heap_clear