www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11938] New: "Ifti!T" for std.traits

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



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: -------
Jan 16 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11938


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au gmail.co
                   |                            |m



10:40:30 PST ---
https://github.com/D-Programming-Language/phobos/pull/1881

I went with "CompatibleUnqual".

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2014