Open finger563 opened 1 month ago
As a note, this also affects the binding in another way as you can see the Config
and WeightedConfig
are bound to the non-existent pyClassBezier
instead of the correct pyClassBezier_espp_Vector2f
.
Hello,
Looking through the code for adapted_types/adapted_class.py, I see that it only checks that the cpp_element().is_template_partially_specialized() which does not check whether the classes which may contain the class in question (e.g. up the scope chain) may themselves be template classes and specialized. I've been looking through it some to figure out how I might add such a check, but I'm not very familiar with srcml / srcmlcpp so I figured I'd go ahead and open the issue while I work through it to see if you or anyone else has any ideas.
You are on the right track. Adding support for inner template classes is a bit complex, since it is buried in the machinery. Adding support for inner classes would require adding recursion, I guess. I'm on holiday right now, so that I do not have a lot of time for this.
However, I created a branch for the work on this with an initial commit. IMHO, the correct way to work on this is to add an integration test.
See the related commit that creates the branch:
And here are some explanations:
I simplified the C++ test code as much as possible:
template<typename DataType>
struct Pair
{
struct DataContainer
{
DataType value;
};
DataContainer first, second;
};
If you want to give it a try, this branch is a good starting point, as you can test directly from within the litgen repo.
If it is too complex, my advice would be to not use inner template classes, at least for the moment.
Cheers
I have c++ such as:
And when I run litgen on it (specializing
Bezier
using the config), I get output of the form:Where the template class is appropriately specialized, but the contained config structs are not.
Looking through the code for
adapted_types/adapted_class.py
, I see that it only checks that thecpp_element().is_template_partially_specialized()
which does not check whether the classes which may contain the class in question (e.g. up the scope chain) may themselves be template classes and specialized. I've been looking through it some to figure out how I might add such a check, but I'm not very familiar with srcml / srcmlcpp so I figured I'd go ahead and open the issue while I work through it to see if you or anyone else has any ideas.