[Issue 9924] Handy enum accessors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 11 18:22:17 PDT 2013


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



--- Comment #2 from bearophile_hugs at eml.cc 2013-04-11 18:22:16 PDT ---
(In reply to comment #1)
> I don't see much need for FirstMember and LastMember, just as I don't see a
> need for:
> 
> E FirstElement(E)(E[] a) { return a[0]; }
> 
> I believe such functions are trivia.

Maybe you are right, I am not sure.

But note FirstElement is present in Phobos, it's named std.array.front:


@property ref T front(T)(T[] a)
if (!isNarrowString!(T[]) && !is(T[] == void[]))
{
    assert(a.length, "Attempting to fetch the front of an empty array of " ~
T.stringof);
    return a[0];
}

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


More information about the Digitalmars-d-bugs mailing list