[Issue 14293] New: min and max with predicate

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Mar 16 10:23:01 PDT 2015


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

          Issue ID: 14293
           Summary: min and max with predicate
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

There should be overloads of min and max with a predicate, e.g. the code below
chooses the shortest string out of three:

string x, y;
...
auto s = min!((a, b) => a.length < b.length)(x, y, "hello");

--


More information about the Digitalmars-d-bugs mailing list