Commit 4a0df05c authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2297 from gabrieldemarmiesse/showing_range_for_vector

Added an example of iteration for x in vector.
parents c486516b ec84f6db
...@@ -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