[pygccxml-development] Vector of Vectors
Brought to you by:
mbaas,
roman_yakovenko
|
From: Scott S. <sc...@bi...> - 2011-07-23 02:29:05
|
Hi,
Is it possible to have py++ understand a vector of vectors? I have the
following C++ code:
vtest.h:
class Foo {
public:
int doStuff(void) { return 1; }
};
class VectorTest {
public:
VectorTest(void);
std::vector<std::vector<Foo *> > foo;
};
vtest.cpp:
VectorTest::VectorTest(void)
{
for (int i = 0; i < 2; i++)
{
foo.push_back( std::vector<Foo *> () );
for (int j = 0; j < 2; j++)
{
foo[i].push_back ( new Foo() );
}
}
}
After undergoing the binding process, the usage in python results in the
following:
>>> import vectortest
>>> v = vectortest.VectorTest()
>>> v.foo[0][0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: No Python class registered for C++ class std::vector<Foo*,
std::allocator<Foo*> >
Alternatively, is there a mechanism to support multi-dimensional arrays?
Thank you for your help!
Scott
|