Re: Getting the template name of a template instantiation

2016-06-27 Thread Nordlöw via Digitalmars-d-learn
On Monday, 27 June 2016 at 17:17:19 UTC, John wrote: import std.traits; __traits(identifier, TemplateOf!(S!int)); Scratch that, this is what you want: import std.traits; static assert(__traits(isSame, TemplateOf!(S!int), S)); I believe this is what import std.traits : isInstanceOf; is

Re: Getting the template name of a template instantiation

2016-06-27 Thread John via Digitalmars-d-learn
On Monday, 27 June 2016 at 17:14:23 UTC, John wrote: On Monday, 27 June 2016 at 16:40:09 UTC, Nordlöw wrote: If I have a template parameter E = S!int where struct S(T) { S x; } how can I extract the template name part `S` from E`? Something like: static assert(is(templateName!(

Re: Getting the template name of a template instantiation

2016-06-27 Thread Ali Çehreli via Digitalmars-d-learn
On 06/27/2016 09:54 AM, Lodovico Giaretta wrote: On Monday, 27 June 2016 at 16:40:09 UTC, Nordlöw wrote: If I have a template parameter E = S!int where struct S(T) { S x; } how can I extract the template name part `S` from E`? Something like: static assert(is(templateName!(S!in

Re: Getting the template name of a template instantiation

2016-06-27 Thread John via Digitalmars-d-learn
On Monday, 27 June 2016 at 16:40:09 UTC, Nordlöw wrote: If I have a template parameter E = S!int where struct S(T) { S x; } how can I extract the template name part `S` from E`? Something like: static assert(is(templateName!(S!int) == S)); Is this already in Phobos somewhere?

Re: Getting the template name of a template instantiation

2016-06-27 Thread Lodovico Giaretta via Digitalmars-d-learn
On Monday, 27 June 2016 at 16:40:09 UTC, Nordlöw wrote: If I have a template parameter E = S!int where struct S(T) { S x; } how can I extract the template name part `S` from E`? Something like: static assert(is(templateName!(S!int) == S)); Is this already in Phobos somewhere?

Getting the template name of a template instantiation

2016-06-27 Thread Nordlöw via Digitalmars-d-learn
If I have a template parameter E = S!int where struct S(T) { S x; } how can I extract the template name part `S` from E`? Something like: static assert(is(templateName!(S!int) == S)); Is this already in Phobos somewhere?