[Issue 12421] Allow simpler syntax for lambda template declarations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 20 03:24:25 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12421



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-20 03:24:24 PDT ---
A slightly more fair comparison if we take into account that 'static' acts as
'auto':

-----
void main()
{
    import std.algorithm;
    import std.traits;

    {
        static notEmpty(A)(A a) { return !a.filter!(b => b > 0.0).empty; }
        assert(notEmpty([0.0, 0.0, 0.1]));
    }

    {
        // simpler syntax should be supported
        alias notEmpty = a => a.filter!(b => b > 0.0).empty;
        assert(notEmpty([0.0, 0.0, 0.1]));
    }
}
-----

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


More information about the Digitalmars-d-bugs mailing list