Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are probably not compiling it in c++ mode, though you don't quite say what you do. The following works if you paste it into a Sage-4.7 worksheet cell:

%cython 
#clang c++

from libcpp.vector cimport vector as vec

cpdef test_vector(): 
   cdef vec[int] vect 
   cdef int i 
   for i in range(10): 
       vect.push_back(i) 
   for i in range(10): 
       print vect[i]