[Issue 13923] New: Specify guarantees on associative array iteration order volatility
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jan 1 05:39:35 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13923
Issue ID: 13923
Summary: Specify guarantees on associative array iteration
order volatility
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: websites
Assignee: nobody at puremagic.com
Reporter: peter.alexander.au at gmail.com
Suppose I have an associative array:
string[int] a = [1:"a", 2:"b", 3:"c"];
Now, associative arrays have unspecified iteration order, but suppose I iterate
the array and it iterates in order {2, 1, 3}.
What guarantees are provided on subsequent iterations? Specifically:
* If I iterate the array again, without modifying any keys or values, or
inserting, removing, or rehashing; is the iteration order guaranteed to be the
same?
* If I iterate the array again, with only modifying values (not keys), is the
iteration order guaranteed to be the same?
The spec should specify what operations may alter the iteration order, and what
operations will leave it intact.
--
More information about the Digitalmars-d-bugs
mailing list