Skip to content

How to handle typedefs #541

Answered by saudet
nyholku asked this question in Q&A
Jan 14, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

This isn't working because of a typedef, it's because the template instance is missing. Those need to be given a name:
https://github.com/bytedeco/javacpp/wiki/Mapping-Recipes#creating-instances-of-c-templates
In this case, something like this should work:

infoMap.put(new Info("opencascade::handle<Base>").pointerTypes("Handle_Base"));
infoMap.put(new Info("opencascade::handle<SomeClass>").pointerTypes("Handle_SomeClass"));
...

You can put this in methods and for loops like this to cut down on the copy/paste:
https://github.com/bytedeco/javacpp-presets/blob/master/pytorch/src/main/java/org/bytedeco/pytorch/presets/torch.java#L1232
https://github.com/bytedeco/javacpp-presets/blob/master/pyt…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nyholku
Comment options

Answer selected by nyholku
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants