Tuple List

Salih Dincer salihdb at hotmail.com
Wed Sep 4 07:51:05 UTC 2024


Why doesn't t2 give the same result as t1?

```d
import std.algorithm;
import std.typecons;

alias T = Tuple!(string, "key", int, "value");

auto t1 = [T("WC", 0), T("Atelye", 0),
       T("Mutfak", 41),
       T("Salon", 42)
];
assert(t1.find!"a.value > 0"
          .map!"a.key"
          .equal(["Mutfak", "Salon"])
);

auto t2 = [T("WC", 0),
       T("Mutfak", 41),
       T("Salon", 42),
       T("Atelye", 0)
];
assert(t2.find!"a.value > 0"
          .map!"a.key"
          .equal(["Mutfak", "Salon", "Atelye"])
);
```


More information about the Digitalmars-d-learn mailing list