[Issue 4292] New: [PATCH] CommonType fails for singular alias value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 7 16:35:09 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4292
Summary: [PATCH] CommonType fails for singular alias value
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: simen.kjaras at gmail.com
--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2010-06-07 16:35:07 PDT ---
std.traits.CommonType does not correctly handle the situation of one single
value (non-type) parameter, i.e. CommonType!3.
Solution here:
template CommonType(T...)
{
static if (!T.length)
alias void CommonType;
else static if (T.length == 1)
{
static if (is(typeof(T[0])))
alias typeof( T[0] ) commonOrSingleType;
else
alias T[0] commonOrSingleType;
}
else static if (is(typeof(true ? T[0].init : T[1].init) U))
alias CommonType!(U, T[2 .. $]) CommonType;
else
alias void CommonType;
}
--
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