.true. when entry left must pop before entry right.
Compares (key, insertion index) lexicographically, which makes the
ordering total and the tie behaviour FIFO.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(heap_t), | intent(in) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | left | |||
| integer(kind=default_int), | intent(in) | :: | right |
pure function precedes(self, left, right) result(first) !! `.true.` when entry `left` must pop before entry `right`. !! !! Compares `(key, insertion index)` lexicographically, which makes the !! ordering total and the tie behaviour FIFO. class(heap_t), intent(in) :: self integer(default_int), intent(in) :: left integer(default_int), intent(in) :: right logical :: first if (self%keys(left) == self%keys(right)) then first = (self%insertion(left) < self%insertion(right)) else if (self%max_heap) then first = (self%keys(left) > self%keys(right)) else first = (self%keys(left) < self%keys(right)) end if end function precedes