www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Getting template details?

reply "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Inspired by Nick's post on stringof weirdness, I started wondering - is
there a way to get ahold of the FQN of the template (not the
instantiation), given an instantiation? Same goes for getting a typetuple
of the parameters. Anyone know?

Basically, what I thought might work would be:

template getTemplate( T : U!( V ), U, V... ) {
     alias U getTemplate;
}

template TemplateParameters( T : U!( V ), U, V... ) {
     alias V TemplateParameters;
}

-- 
Simen
Dec 05 2009
parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
On Sun, 06 Dec 2009 07:20:28 +0100, Simen kjaeraas  
<simen.kjaras gmail.com> wrote:

 Inspired by Nick's post on stringof weirdness, I started wondering - is
 there a way to get ahold of the FQN of the template (not the
 instantiation), given an instantiation? Same goes for getting a typetuple
 of the parameters. Anyone know?

 Basically, what I thought might work would be:

 template getTemplate( T : U!( V ), U, V... ) {
      alias U getTemplate;
 }

 template TemplateParameters( T : U!( V ), U, V... ) {
      alias V TemplateParameters;
 }
Nobody? Maybe I should file an enhancement request for this, then. -- Simen
Dec 08 2009