The order in which keys are sorted (a stable sort, comparing in ASCII order).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in) | :: | keys(:) |
the sort keys |
function sorted_order(keys) result(order) !! The order in which `keys` are sorted (a stable sort, comparing in ASCII order). type(string_t), intent(in) :: keys(:) !! the sort keys integer, allocatable :: order(:) integer :: i, j, t order = [(i, i=1, size(keys))] do i = 2, size(keys) t = order(i) j = i - 1 do while (j >= 1) if (.not. llt(keys(t)%s, keys(order(j))%s)) exit order(j + 1) = order(j) j = j - 1 end do order(j + 1) = t end do end function sorted_order