All keys, in insertion order.
Fortran arrays are not ragged, so every element has the same length:
keys shorter than the longest one are blank-padded on the right. That
padding is lossy for keys that themselves end in blanks, and a
zero-length key comes back as a blank string. Use at() when the
exact key text matters. The result is zero-sized for an empty map.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hash_map_t), | intent(in) | :: | this |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | private | :: | i | ||||
| integer(kind=default_int), | private | :: | longest |
function hash_map_keys(this) result(res) !! All keys, in insertion order. !! !! Fortran arrays are not ragged, so every element has the same length: !! keys shorter than the longest one are blank-padded on the right. That !! padding is lossy for keys that themselves end in blanks, and a !! zero-length key comes back as a blank string. Use `at()` when the !! exact key text matters. The result is zero-sized for an empty map. class(hash_map_t), intent(in) :: this character(len=:), allocatable :: res(:) integer(default_int) :: i, longest longest = 1 do i = 1, this%n_entries if (this%key_size(i) > longest) longest = this%key_size(i) end do allocate (character(len=longest) :: res(this%n_entries)) do i = 1, this%n_entries res(i) = entry_key(this, i) end do end function hash_map_keys