www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4292] New: [PATCH] CommonType fails for singular alias value

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: simen.kjaras gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras 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: -------
Jun 07 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4292


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |FIXED


--- Comment #1 from David Simcha <dsimcha yahoo.com> 2010-08-15 08:05:10 PDT ---
Fixed SVN.

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