www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14293] New: min and max with predicate


          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 puremagic.com
          Reporter: andrei 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");

Mar 16 2015