[Issue 9119] [AA] Forward range addition to associative arrays.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 3 12:02:51 PST 2015


https://issues.dlang.org/show_bug.cgi?id=9119

--- Comment #7 from bearophile_hugs at eml.cc ---
The printing of such key-value pairs is not very good. I don't know if you want
to improve this, or leave the better printing to byPair:


void main() {
    import std.stdio, std.algorithm;
    auto aa = [1:2, 3:4];
    aa.byKeyValue.writeln;
}


[Pair(1513FE8, 1513FEC), Pair(1513FC8, 1513FCC)]

-----------------

There are also problems with a constant key-value pair:


void main() {
    auto aa = [1:2, 3:4];
    foreach (const t; aa.byKeyValue) {
        auto k = t.key;
        auto v = t.value;
    }
}


test.d(4,18): Error: mutable method object.byKeyValue!(int[int], int,
int).byKeyValue.Result.front.Pair.key is not callable using a const object
test.d(5,18): Error: mutable method object.byKeyValue!(int[int], int,
int).byKeyValue.Result.front.Pair.value is not callable using a const object

-----------------

--


More information about the Digitalmars-d-bugs mailing list