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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 23 18:26:10 PDT 2013


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


thelastmammoth at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thelastmammoth at gmail.com


--- Comment #9 from thelastmammoth at gmail.com 2013-06-23 18:26:08 PDT ---
(In reply to comment #4)
> 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.

I don't see it ? But I added it in
https://github.com/D-Programming-Language/phobos/pull/1367.

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