Commit ec84f6db authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Added an example of iteration with for with a vector.

parent 45df4830
...@@ -463,11 +463,13 @@ For example:: ...@@ -463,11 +463,13 @@ For example::
from libcpp.vector cimport vector from libcpp.vector cimport vector
cdef vector[int] vect cdef vector[int] vect
cdef int i cdef int i, x
for i in range(10): for i in range(10):
vect.push_back(i) vect.push_back(i)
for i in range(10): for i in range(10):
print(vect[i]) print(vect[i])
for x in vect:
print(x)
The pxd files in ``/Cython/Includes/libcpp`` also work as good examples on The pxd files in ``/Cython/Includes/libcpp`` also work as good examples on
how to declare C++ classes. how to declare C++ classes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment