[Issue 11938] New: "Ifti!T" for std.traits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 16 09:58:29 PST 2014


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

           Summary: "Ifti!T" for std.traits
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2014-01-16 09:58:27 PST ---
traits has "Unqual", which can give the Unqualified type of something. However,
there is no guarantee that "T : Unqual!T".

For types where "T : Unqual!T", I'd like a template called "Ifti" that returns
Unqual!T, and T otherwise.

This would, in particular, be useful for templates that operate on ranges.

For example:
strut S
{
    int i;
}
strut P
{
    int* p;
}

Ifti!(const(int[])) => const(int)[]
Ifti!(const(S)) => S
Ifti!(const(P)) => const(P)

Not sure "Ifti" is the correct name, but I couldn't think of better.

-- 
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