Tuple List
drug007
drug2004 at bk.ru
Wed Sep 4 08:04:58 UTC 2024
On 04.09.2024 10:51, Salih Dincer wrote:
> 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"]) );
You should use filter instead of find. Find finds the first element and
returns the range from that first element to the end of the original range.
More information about the Digitalmars-d-learn
mailing list