You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been working with %template and std_vector and have been running into some issues. I’m running on windows, but I don’t believe this will be platform specific. I also use the following command line to build (don’t think it’s relevant, but I’m adding it just in case):
And, last of all, here is the python code I’m trying to execute:
frommodimport*lst= [myCouple(), myCouple()]
get5(lst) # Should print 5get5b(lst) # Should print 5myCouple.get5c(lst) # Should print 5
get5, get5b work. But myCouple.get5c does not..
Here is a slightly modified version (for clarity, getting rid of other answers not relevant to this issue) of William's response (swig-devel, emailed 12/15/2014 2:14AM EST):
However, there is a catch 22 here as myTCouple is used within the myTCouple class itself. SWIG's handling of this is buggy and I suggest you raise a bug report in Github for this case. If you swap the two %template calls around [...], it will work. This is the only workaround I could find and is technically incorrect as the two %template calls are then the wrong way round.
The text was updated successfully, but these errors were encountered:
There have been quite a few %template-related fixes since Jan 2022 so I retested, but this is still reproducible with current git master (and swapping the order still makes it work).
I have been working with %template and std_vector and have been running into some issues. I’m running on windows, but I don’t believe this will be platform specific. I also use the following command line to build (don’t think it’s relevant, but I’m adding it just in case):
swig.exe -threads -python -modern -c++ -Iswig\lib\python -Iswig\lib\std -Iswig\lib mod.i
I am currently using swig 2.0.10, but I believe wsfulton as seen this in 3.X as well (I originally sent a swig-devel email).
Here is my interface file, with C++ code baked in to make things easier:
And, last of all, here is the python code I’m trying to execute:
get5, get5b work. But myCouple.get5c does not..
Here is a slightly modified version (for clarity, getting rid of other answers not relevant to this issue) of William's response (swig-devel, emailed 12/15/2014 2:14AM EST):
However, there is a catch 22 here as myTCouple is used within the myTCouple class itself. SWIG's handling of this is buggy and I suggest you raise a bug report in Github for this case. If you swap the two %template calls around [...], it will work. This is the only workaround I could find and is technically incorrect as the two %template calls are then the wrong way round.
The text was updated successfully, but these errors were encountered: