How to expose std::vector<int> as a Python list using SWIG? How to expose std::vector<int> as a Python list using SWIG? python python

How to expose std::vector<int> as a Python list using SWIG?


%template(IntVector) vector<int>;


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"%}