> That's not a bug. That is you not knowing C++. vect[0] dereferences a > pointer in your code. What you get is the an object of type vector<int> > as Cython says, not an int contained in the vector.
Ooooppss. Shame on me! This is indeed a mistake from me, not a bug. I should have re-read the code more carefully. I think I was slightly disturbed here by the fact that cython use the dot operator for both the "." and "->" of C. Seeing "vect.push_back(6)" above "print vect[0]" made me forget that vect was not a vector but a pointer. Replacing vect[0] by vect[0][0], everything is OK. Sorry, sorry for that and thanks for noticing. As for me not understanding c++, however, please note that: 1- this was meant as a minimal bug code stripped out of any context 2- cython doesn't allow (AFAIU) stack-allocated c++ object as members of a python extension class. Therefore, if one wants to create a Python class wrapping a vector, I think one has to write things like "self.pVect=new vector<xxx>" (and of course add the appropriate "del self.pVect" in the "__dealloc__" method of the class. Of course, I am still trying to understand how the c++ mode of cython works, therefore I might be wrong. _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
