[Issue 4265] It should be possible to query template parameters with __traits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 20 14:55:17 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4265


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-20 14:55:16 PST ---
As a partial workaround if you know the original template a type was
instantiated with you can use:

struct Foo(T1, T2)
{
}

alias Foo!(int, float) X;

template GetParams(R, alias X)
{
    static if (is(R x == X!T, T...))
    {
        alias T GetParams;
    }
}

void main()
{
    pragma(msg, GetParams!(X, Foo));
}

There's also an 'isTemplateInstance' now in std.traits.

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


More information about the Digitalmars-d-bugs mailing list