Commit 03ed3abc authored by Robert Bradshaw's avatar Robert Bradshaw

Fix cpp iterator test.

parent d0a8e247
# tag: cpp # tag: cpp
from libcpp.vector cimport vector from libcpp.vector cimport vector
from cython.operator cimport dereference as deref
cdef extern from "cpp_iterators_simple.h": cdef extern from "cpp_iterators_simple.h":
cdef cppclass DoublePointerIter: cdef cppclass DoublePointerIter:
...@@ -52,13 +53,13 @@ def test_custom(): ...@@ -52,13 +53,13 @@ def test_custom():
def test_iteration_over_heap_vector(L): def test_iteration_over_heap_vector(L):
""" """
>>> test_iteration_over_heap_vector([1,2]) >>> test_iteration_over_heap_vector([1,2])
(1, 2) [1, 2]
""" """
cdef int i cdef int i
cdef vector[int] *vint = new vector[int]() cdef vector[int] *vint = new vector[int]()
try: try:
for i in L: for i in L:
vint.push_back(i) vint.push_back(i)
return [ i for i in vint ] return [ i for i in deref(vint) ]
finally: finally:
del vint del vint
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