http://d.puremagic.com/issues/show_bug.cgi?id=5305


Walter Bright <bugzi...@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzi...@digitalmars.com


--- Comment #1 from Walter Bright <bugzi...@digitalmars.com> 2012-01-20 
12:17:17 PST ---
For convenience, here's the example:

import std.math;

T[] map(T, V)(T function(T) f, V[] list)
{
    T[] result = new T[](list.length);

    foreach(k, v; list)
    {
        result[k] = f(v);
    }

    return result;
}

void main()
{
    assert (map!(real, float) (&sqrt, [4.0f, 9.0f]) == [2.0f, 3.0f]);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to