--- Comment #9 from 2011-05-23 05:12:44 PDT ---
Another example, compared to using minPos():

import std.stdio, std.algorithm, std.array;

void main() {
    string[] data = ["red", "hello", "yes", "no", "roger", "bud"];

    // works in DMD 2.053
    string r1 = minPos!q{ walkLength(a) > walkLength(b) }(data).front();

    // proposed
    string r2 = max!q{ walkLength(a) }(items);

The second version is shorter and more readable, and just like schwartzSort()
the modified max() is more efficient than using minPos when the mapping
function becomes costly to compute.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to