[Issue 11828] New: std.typecons.Typedef with two arguments too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 26 16:35:27 PST 2013


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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list