Open ombre5733 opened 7 years ago
I added a small example with c++ templates: http://pygccxml.readthedocs.io/en/develop/examples/templates/example.html
That should help you.
For the moment, castxml
(and previously gccxml
) output only the following:
<Struct id="_15" name="T<ns::B::D, bool>" context="_7" location="f1:14" file="f1" line="14" incomplete="1"/>
So for the moment, we can only rely on the name attribute to extract information about the template parameters. The example will show you how to do this, using the declarations.templates.split
helper method. This will allow you to loop over the template parameters.
The only thing is that what you will get is strings, not some pygccxml object that you can use directly. Ideally one would expect some declaration_t
objects instead, which you can work on. But for this, I will need to change the castxml
code, so this would be a long term project.
I hope this helps you.
Is there a way to loop over the types defined inside a template? I'm currently testing the library with the following code:
Starting with namespace
A
, I'm able to go to the template declaration but then I'm stuck.Is there somewhere a link from
class_declaration_t
to the scope so that I can recurse into the template?