Skip to content Skip to sidebar Skip to footer

How To Expose Std::vector As A Python List Using Swig?

I'm trying to expose this function to Python using SWIG: std::vector get_match_stats(); And I want SWIG to generate wrapping code for Python so I can see it as a list o

Solution 1:

%template(IntVector) vector<int>;

Solution 2:

I don't have much experience with Swig, but are you #including your C++ header file in your .i file? Try one (or both) of

%include "myvector.h"


%{
#   include "myvector.h"
%}

Post a Comment for "How To Expose Std::vector As A Python List Using Swig?"