summaryrefslogtreecommitdiff
path: root/tests/run/cpp_stl_vector_cpp11.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/cpp_stl_vector_cpp11.pyx')
-rw-r--r--tests/run/cpp_stl_vector_cpp11.pyx27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/run/cpp_stl_vector_cpp11.pyx b/tests/run/cpp_stl_vector_cpp11.pyx
new file mode 100644
index 000000000..a2d54b333
--- /dev/null
+++ b/tests/run/cpp_stl_vector_cpp11.pyx
@@ -0,0 +1,27 @@
+# mode: run
+# tag: cpp, werror, no-cpp-locals, cpp11
+
+from cython.operator cimport dereference as d
+from cython.operator cimport preincrement as incr
+
+from libcpp.vector cimport vector
+
+def const_iteration_test(L):
+ """
+ >>> const_iteration_test([1,2,4,8])
+ 1
+ 2
+ 4
+ 8
+ """
+ v = new vector[int]()
+ try:
+ for a in L:
+ v.push_back(a)
+ it = v.cbegin()
+ while it != v.cend():
+ a = d(it)
+ incr(it)
+ print(a)
+ finally:
+ del v