Commit 88ffe8bb authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2445 from gabrieldemarmiesse/test_wrapping_cplusplus_4

Added tests for "Using C++ in Cython" part 4
parents b4fa0cd9 05eaaa26
# distutils: language = c++
from libcpp.vector cimport vector
cdef vector[int] vect
cdef int i, x
for i in range(10):
vect.push_back(i)
for i in range(10):
print(vect[i])
for x in vect:
print(x)
...@@ -355,18 +355,9 @@ Most of the containers of the C++ Standard Library have been declared ...@@ -355,18 +355,9 @@ Most of the containers of the C++ Standard Library have been declared
in pxd files located in ``/Cython/Includes/libcpp``. These containers in pxd files located in ``/Cython/Includes/libcpp``. These containers
are: deque, list, map, pair, queue, set, stack, vector. are: deque, list, map, pair, queue, set, stack, vector.
For example:: For example:
from libcpp.vector cimport vector .. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/vector_demo.pyx
cdef vector[int] vect
cdef int i, x
for i in range(10):
vect.push_back(i)
for i in range(10):
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