-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Unclear documentation around HashMap iteration order #89040
Copy link
Copy link
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The documentation for HashMap on the methods
keys,values,iter, etc is phrasedThe
std::collectionsmodule documentation statesTo me this makes it clear that I cannot expect any specific iteration order. What is not clear is whether the iteration order is persistent across multiple calls to the same HashMap without modification in between.
Are these two loops guaranteed to iterate in the same order?
Or these?
Erring on the side of caution I would say that no the iteration order is not guaranteed to be the same.
The documentation should clarify this. I don't know whether the iteration order should be guaranteed in this case but either way it should be clarified.