Hi,

Is the following way valid to expose a 2D array variable from python (Vp)  to 
c++(Vp_cpp)?
   

std::vector<std::vector<double> > Vp_cpp;
boost::python::class_<std::vector<std::vector<double> > 
>("PyVec").def(boost::python::vector_indexing_suite<std::vector<std::vector<double>
 > >());


main_namespace["Vp"] = boost::python::ptr(&Vp_cpp);

But, then if I tried to manipulate the 2D vector in C++ like the following, it 
doesn't work:

Vp_cpp[1][1] = 999;
std::cout << "Vp_cpp[1][1] = " << Vp_cpp[1][1] << std::endl;  // It doesn't 
print to


What could be wrong or am I missing something?

Thanks in advance.
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to