Bug 3480 – Overload Select to work on aliases

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-11-06T12:42:00Z
Last change time
2015-06-09T01:26:56Z
Assigned to
nobody
Creator
k-foley

Comments

Comment #0 by k-foley — 2009-11-06T12:42:06Z
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); }
Comment #1 by andrej.mitrovich — 2011-05-24T21:38:52Z
Seems to be fixed, it works for me using 2.053 (I have tested with -unittest).