www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11828] New: std.typecons.Typedef with two arguments too

https://d.puremagic.com/issues/show_bug.cgi?id=11828

           Summary: std.typecons.Typedef with two arguments too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-12-26 16:35:23 PST ---
In some cases I have to tell apart different Typedefs using the cookie, but I
don't need to specify a different init value:

alias Meters = Typedef!(double, "Meters");
alias Liters = Typedef!(double, "Liters");


For such cases I suggest to replace this part of the std.typecons module:


/**
Library typedef.
 */
template Typedef(T)
{
    alias .Typedef!(T, T.init) Typedef;
}



With two (shorter) aliases:


/// Library typedef.
alias Typedef(T) = .Typedef!(T, T.init);

/// ditto
alias Typedef(T, string cookie=null) = .Typedef!(T, T.init, cookie);

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