www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3480] New: Overload Select to work on aliases

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3480

           Summary: Overload Select to work on aliases
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: k-foley onu.edu


--- Comment #0 from Kyle Foley <k-foley onu.edu> 2009-11-06 12:42:06 PST ---
template Select(bool condition, alias T, alias F)
{
    static if (condition) alias T Select;
    else alias F Select;
}
template Select(bool condition, T, F)
{
    static if (condition) alias T Select;
    else alias F Select;
}

unittest
{
    static assert(is(Select!(true, int, long) == int));
    static assert(is(Select!(false, int, long) == long));
    static assert(Select!(true, 1, 5) == 1);
    static assert(Select!(false, 42, 23) == 23);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 06 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3480


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-05-24
21:38:52 PDT ---
Seems to be fixed, it works for me using 2.053 (I have tested with -unittest).

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