views:

98

answers:

1

I want to wrap a C++ vector of vectors to Python code by using SWIG.

Is it possible to wrap this type of vector of vectors?

std::vector<std::vector<MyClass*>>;

In the interface file MyApplication.i I added these lines:

%include "std_vector.i"
%{ 
#include <vector> 
%} 

namespace std {
   %template(VectorOfStructVector) vector<vector<MyClass*>>;
}

But, I'm getting an Error when SWIG is executed. I'm able to wrap this type (using reference to the vector):

 std::vector<std::vector<MyClass*>*>;

But, it's not working properly, I cannot access the items. That's why I'm interested in this type (without the reference):

 std::vector<std::vector<MyClass*>>;

Any ideas?

+1  A: 

Is it a C++ parsing issue?

 std::vector<std::vector<MyClass*> >;
 ---Important space---------------^
Charles Beattie
Thanks John and Charles!!! It's working! It was the blank space...
Javier
Also this line was needed in the interface file: %template(VectorOfStructVector) vector<vector<MyClass*> >;
Javier