You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hashmap in the stdlib does not provide a way to retrieve all keys in the map. As shown in the Prior Art section, a way to retrieve all keys in a hashmap is required in other programming languages, and it would significantly expands the use of the hashmap.
The hashmaps in the stdlib, including open_hash_map_type and chaining_hash_map_type, store both the entered keys and values to the component inverse. So it is not challenging work to retrieve the keys as a key_type array.
The conversion from the key_type to the original type is left to the users.
The text was updated successfully, but these errors were encountered:
degawa
added
the
idea
Proposition of an idea and opening an issue to discuss it
label
Aug 20, 2023
In TOML Fortran the map types support returning a list of keys, which can be used to iterate through the data structure. In general using stdlib' s map type in TOML Fortran requires this functionality, and one way of implementing this would be to just store the keys in a list beside the map.
The hashmaps in the stdlib, including open_hash_map_type and chaining_hash_map_type, store both the entered keys and values to the component inverse. So it is not challenging work to retrieve the keys as a key_type array.
It seems you already have an idea on how to implement such an option. Would you like to open a PR for its implemenation?
Motivation
The hashmap in the stdlib does not provide a way to retrieve all keys in the map. As shown in the Prior Art section, a way to retrieve all keys in a hashmap is required in other programming languages, and it would significantly expands the use of the hashmap.
Prior Art
The Map in Java has the
SetKey()
method that returns the keys in this map.The
list()
function for Python'sdict
returns a list of all the keys used in the dictionary.The
unordered_map
in C++ does not have a similar method, but a way to get all the keys is required. (for example, see https://stackoverflow.com/questions/8483985/obtaining-list-of-keys-and-values-from-unordered-map)Additional Information
The hashmaps in the stdlib, including
open_hash_map_type
andchaining_hash_map_type
, store both the entered keys and values to the componentinverse
. So it is not challenging work to retrieve the keys as akey_type
array.The conversion from the
key_type
to the original type is left to the users.The text was updated successfully, but these errors were encountered: