Using an Iterable std::map in Java code with SWIG 4.x #3199
Replies: 3 comments
-
Possibly the change came with this PR: #1356 Up until SWIG 3.0.12 I don't see the generated errors, SWIG 4.0.0 is the first version I see them in. And in particular this commit is the first one I see the error with: 573ddb0 |
Beta Was this translation helpful? Give feedback.
-
If I rename the If there is some way to also generate the needed Java method, it would be great. E.g. rename the method:
And then add this to the generated Java code (no idea how to do that unfortunately):
|
Beta Was this translation helpful? Give feedback.
-
The C++ standard std::map already defines
Also consider dropping all your customisations and use the new SWIG wrapped version unchanged as it implements java.util.AbstractMap which has a standard Java API for iterating over both the keys and values. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
we have an issue when updating some code from SWIG 2.0.10 to SWIG 4.0.2.
We have the following
.i
file:We compile it with:
Using SWIG 2.0.10, this compiles fine:
When using SWIG 4.0.2, we run into errors in the generated
.cxx
code:The generated code with SWIG 4.0.2 is generating
iterator result
instead ofstd::map< std::string,std::string >::iterator result
:I've noticed that the generated
.cxx
code is fine, if I pull the definition ofmap_String_String
before the@extend
line:(no error in
.cxx
)(error in
.cxx
)Unfortunately, when I re-order the lines, the generated Java class has an error:
How to rewrite the
.i
file to have the same functionality (a map that implementsIterable
) with SWIG 4.x?Best regards and thanks,
Simeon
Beta Was this translation helpful? Give feedback.
All reactions