[Issue 4265] It should be possible to query template parameters with __traits
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 6 06:40:59 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4265
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |k.hara.pg at gmail.com
--- Comment #8 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-04-06 06:40:55 PDT ---
(In reply to comment #5)
> I can have a pull ready soon for 2 traits:
I managed to lose the branch where I implemented this. I think I only did it
partially though.
@kenji: If you have this:
template T(Args...) { }
struct S(Args...) { }
alias Tint = T!int;
alias Sint = S!int;
How do you get to the 'S' declaration from the instance? I want to implement
these traits:
static assert(is(__traits(getTemplateSymbol, SInt) == S));
static assert(is(__traits(getTemplateArgs, SInt) == int));
I've tried this in traits.c:
Dsymbol *s = getDsymbol(o);
TemplateInstace *ti = s->isTemplateInstance();
However that only works for Tint, and not for Sint. 's' is actually a
StructDeclaration for Sint, not a TemplateInstance.
--
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