From: Michael F. <mic...@ya...> - 2011-02-22 17:36:31
|
Hello, I am working on exposing a C++ implementation that makes heavy use of vectors. In particular, the implementation has a number for functions that return std::vector as in: typedef std::vector<DimensionDesc> Dimensions; const Dimensions& ClientArray::getDimensions() const; In python I would expect to be able to do: >>> myvector = myarray.getDimensions() >>> print myvector[0] In the above example myarray is returned by another C++ function and the python function "help (myarray)" shows that python correctly recognizes myarray as an object of type ClientArray with all the methods exposed for use by python. Unfortunately, python does not recognize the data returned by getDimensions as a vector. SWIG processes all the relevant .h and .cpp files containing the typedef and function definition through %include. I cannot use vector access techniques in python (e.g. myvector[i] ) against the returned vector. My SWIG input contains %include "std_vector.i". Suggestions? Mike Fabbri |