[cfe-dev] Getting the corresponding template parameters of a template argument list in partial template specializations

Olivier olivier.grant at gmail.com
Mon Jul 26 02:40:50 PDT 2010


I'm trying to figure out how I can retrive the template parameters that 
correspond to certain template arguments in the template argument list of a 
partial template specialization (ouf), i.e. :

template< typename Tp0, int N0, typename Tp1, int N1 >
    struct Foo
    { /* ... */ }

template< typename Tp0, int N1 >
    struct Foo<Tp0,1,short,N1>
    { /* ... */ }

In this example, the TemplateArgumentList object I get from the 
ClassTemplatePartialSpecializationDecl will contain 4 template arguments :

  - One of kind TemplateArgument::Type
  - One of kind TemplateArgument::Integral
  - One of kind TemplateArgument::Type
  - One of kind TemplateArgument::Expression

And a TemplateParameters of two elements.

I can't seem to figure out how to get the identifier of template arguments of 
type TemplateArgument::Expression. How can I achieve this ?

As a more general question, I would like to be able to print 
out "<Tp0,1,short,N1>" from the corresponding 
ClassTemplatePartialSpecialization object. What is the best way to do this ?

Thanks alot for your time,


More information about the cfe-dev mailing list